1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-05 11:37:10 +01:00
build/pkg/rootfs/build
David Oberhollenzer 8fa44569d8 cleanup: remove deploy directory argument from package command
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-06 10:03:12 +01:00

76 lines
2.3 KiB
Text
Executable file

DEPENDS=$(cat_file_merge "ROOTFS" | sort -u)
build() {
# setup skeleton
mkdir -pv ${PKGBUILDDIR}/{bin,dev,sys,proc,tmp,run,boot,usr,mnt,share}
mkdir -pv ${PKGBUILDDIR}/cfg/{preserve,overlay}
mkdir -pv ${PKGBUILDDIR}/etc/{profile.d,skel}
mkdir -pv ${PKGBUILDDIR}/var/lib
mkdir -pv ${PKGBUILDDIR}/lib/libexec
cp -r "$SCRIPTDIR/pkg/$PKGNAME/etc" "$PKGBUILDDIR"
cp -r "$SCRIPTDIR/pkg/$PKGNAME/lib" "$PKGBUILDDIR"
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$PKGDEPLOYDIR/pseudo"
# version info
local fname=$(echo "${OS_NAME}-release" | tr '[:upper:]' '[:lower:]')
echo $OS_RELEASE > $PKGBUILDDIR/etc/$fname
echo "etc/$fname m 644 0 0" >> "$PKGDEPLOYDIR/pseudo"
# local config files
fname=$(file_path_override "resolv.conf")
if [ ! -z "$fname" ]; then
cp "$fname" "./etc/resolv.conf"
echo "etc/resolv.conf m 644 0 0" >> "$PKGDEPLOYDIR/pseudo"
fi
# gather rootfs dependencies
cat_file_merge "ROOTFS" | sort -u | \
xargs pkg install -om -R "$REPODIR" -r "$PKGBUILDDIR"
cat_file_merge "ROOTFS" | sort -u | \
xargs pkg install -R "$REPODIR" \
-r "$PKGBUILDDIR" -F sqfs -l >> "$PKGDEPLOYDIR/pseudo"
# setup root home directory
cp -r "$PKGBUILDDIR/etc/skel" "$PKGBUILDDIR/usr/root"
echo "usr/root m 700 0 0" >> "$PKGDEPLOYDIR/pseudo"
find "./usr/root" -exec stat {} --printf="%n m %a 0 0\\n" \; | \
sed 's#^./##g' | tail -n +2 >> "$PKGDEPLOYDIR/pseudo"
# move configuration to preserve directory
mv "$PKGBUILDDIR/etc" "$PKGBUILDDIR/cfg/preserve/etc"
mv "$PKGBUILDDIR/usr" "$PKGBUILDDIR/cfg/preserve/usr"
mv "$PKGBUILDDIR/var/lib" "$PKGBUILDDIR/cfg/preserve/var_lib"
rm -rf "$PKGBUILDDIR/var"
mkdir -p ${PKGBUILDDIR}/{etc,var,usr}
sed -i 's#etc/#cfg/preserve/etc/#g' "$PKGDEPLOYDIR/pseudo"
sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$PKGDEPLOYDIR/pseudo"
sed -i 's#usr/#cfg/preserve/usr/#g' "$PKGDEPLOYDIR/pseudo"
# don't add stuff for the boot partition to the squashfs image
mv ${PKGBUILDDIR}/boot/* "$PKGDEPLOYDIR"
grep -v "^boot/" "$PKGDEPLOYDIR/pseudo" > "$PKGDEPLOYDIR/pseudo.temp"
mv "$PKGDEPLOYDIR/pseudo.temp" "$PKGDEPLOYDIR/pseudo"
echo "boot m 750 0 0" >> "$PKGDEPLOYDIR/pseudo"
}
deploy() {
mksquashfs "$PKGBUILDDIR" "$PKGDEPLOYDIR/rootfs.img" -comp xz \
-no-progress -no-xattrs -pf "$PKGDEPLOYDIR/pseudo"
rm "$PKGDEPLOYDIR/pseudo"
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
}
check_update() {
return
}