1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-22 19:19:46 +01:00
build/pkg/rootfs/build

50 lines
1.5 KiB
Text
Raw Normal View History

DEPENDS=$(cat_file_merge "ROOTFS" | sort -u)
build() {
# generate pseudo file listing for squashfs
pkg install -l sqfs -R "$REPODIR" -r "$TCDIR/$TARGET" $DEPENDS |\
sort -u > "$PKGDEPLOYDIR/pseudo"
# move configuration to preserve directory
mkdir -pv "$TCDIR/$TARGET/cfg/preserve" "$TCDIR/$TARGET/cfg/overlay"
echo <<_EOF >> "$PKGDEPLOYDIR/pseudo"
cfg m 755 0 0
cfg/preserve m 755 0 0
cfg/preserve/etc m 755 0 0
cfg/preserve/usr m 755 0 0
cfg/preserve/var_lib m 755 0 0
cfg/overlay m 755 0 0
_EOF
mv "$TCDIR/$TARGET/etc" "$TCDIR/$TARGET/cfg/preserve/etc"
mv "$TCDIR/$TARGET/usr" "$TCDIR/$TARGET/cfg/preserve/usr"
mv "$TCDIR/$TARGET/var/lib" "$TCDIR/$TARGET/cfg/preserve/var_lib"
rm -rf "$TCDIR/$TARGET/var"
mkdir -p $TCDIR/$TARGET/{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 $TCDIR/$TARGET/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 "$TCDIR/$TARGET" "$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
}