1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-16 16:37:10 +01:00
build/pkg/rootfs/build
David Oberhollenzer b7e5ce8118 Add package files for rootfs and rpi3 bootup files
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-03 17:47:02 +01:00

82 lines
2.3 KiB
Text
Executable file

DEPENDS=$(cat_file_merge "ROOTFS" | sort -u)
build() {
local SOURCE="$1"
local DEPLOY="$2"
# 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" "$DEPLOY/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" >> "$DEPLOY/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" >> "$DEPLOY/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 >> "$DEPLOY/pseudo"
# setup root home directory
cp -r "$PKGBUILDDIR/etc/skel" "$PKGBUILDDIR/usr/root"
echo "usr/root m 700 0 0" >> "$DEPLOY/pseudo"
find "./usr/root" -exec stat {} --printf="%n m %a 0 0\\n" \; | \
sed 's#^./##g' | tail -n +2 >> "$DEPLOY/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' "$DEPLOY/pseudo"
sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$DEPLOY/pseudo"
sed -i 's#usr/#cfg/preserve/usr/#g' "$DEPLOY/pseudo"
# don't add stuff for the boot partition to the squashfs image
mv ${PKGBUILDDIR}/boot/* "$DEPLOY"
grep -v "^boot/" "$DEPLOY/pseudo" > "$DEPLOY/pseudo.temp"
mv "$DEPLOY/pseudo.temp" "$DEPLOY/pseudo"
echo "boot m 750 0 0" >> "$DEPLOY/pseudo"
}
deploy() {
local SOURCE="$1"
local DEPLOY="$2"
mksquashfs "$PKGBUILDDIR" "$DEPLOY/rootfs.img" -comp xz \
-no-progress -no-xattrs -pf "$DEPLOY/pseudo"
rm "$DEPLOY/pseudo"
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$DEPLOY"
}
check_update() {
return
}