1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-22 11:09:46 +01:00
build/pkg/rootfs/build
David Oberhollenzer 26a9b8002f Cleanup rootfs package
- move the skeleton setup stuff out of the rootfs package into a
   sperate package called "basefiles"
 - remove manual unpacking from rootfs, we already have all the dependencies
   installed in the toolchain sysroot.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-07 20:12:19 +01:00

59 lines
1.8 KiB
Text
Executable file

DEPENDS=$(cat_file_merge "ROOTFS" | sort -u)
build() {
# generate pseudo file listing for squashfs
pkg install -l -R "$REPODIR" -r "$TCDIR/$TARGET" \
-F sqfs $DEPENDS | sort -u > "$PKGDEPLOYDIR/pseudo"
# setup root home directory
cp -r "$TCDIR/$TARGET/etc/skel" "$TCDIR/$TARGET/usr/root"
echo "usr/root m 700 0 0" >> "$PKGDEPLOYDIR/pseudo"
find "$TCDIR/$TARGET/usr/root" \
-exec stat {} --printf="%n m %a 0 0\\n" \; | \
sed 's#^$TCDIR/$TARGET/##g' | tail -n +2 >> "$PKGDEPLOYDIR/pseudo"
# move configuration to preserve directory
mkdir -pv "$TCDIR/$TARGET/cfg/preserve"
mkdir -pv "$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
}