2018-02-20 21:30:34 +01:00
|
|
|
DEPENDS=$(cat_file_merge "ROOTFS" | sort -u)
|
2018-01-24 12:52:41 +01:00
|
|
|
|
2018-01-16 17:44:43 +01:00
|
|
|
build() {
|
|
|
|
# setup skeleton
|
2018-06-16 17:46:17 +02:00
|
|
|
mkdir -pv ${PKGBUILDDIR}/{bin,dev,sys,proc,tmp,run,boot,usr,mnt,share}
|
2018-02-16 23:22:04 +01:00
|
|
|
mkdir -pv ${PKGBUILDDIR}/cfg/{preserve,overlay}
|
2018-06-16 17:46:17 +02:00
|
|
|
mkdir -pv ${PKGBUILDDIR}/etc/{profile.d,skel}
|
|
|
|
mkdir -pv ${PKGBUILDDIR}/var/lib
|
|
|
|
mkdir -pv ${PKGBUILDDIR}/lib/libexec
|
2018-01-16 17:44:43 +01:00
|
|
|
|
2018-02-16 23:22:04 +01:00
|
|
|
cp -r "$SCRIPTDIR/pkg/$PKGNAME/etc" "$PKGBUILDDIR"
|
2018-02-17 14:47:42 +01:00
|
|
|
cp -r "$SCRIPTDIR/pkg/$PKGNAME/lib" "$PKGBUILDDIR"
|
2019-03-06 10:03:12 +01:00
|
|
|
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "$PKGDEPLOYDIR/pseudo"
|
2018-06-16 17:46:17 +02:00
|
|
|
|
|
|
|
# version info
|
|
|
|
local fname=$(echo "${OS_NAME}-release" | tr '[:upper:]' '[:lower:]')
|
|
|
|
|
|
|
|
echo $OS_RELEASE > $PKGBUILDDIR/etc/$fname
|
2018-02-05 14:04:27 +01:00
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
echo "etc/$fname m 644 0 0" >> "$PKGDEPLOYDIR/pseudo"
|
2018-06-16 17:46:17 +02:00
|
|
|
|
2018-06-19 18:33:30 +02:00
|
|
|
# local config files
|
|
|
|
fname=$(file_path_override "resolv.conf")
|
|
|
|
|
|
|
|
if [ ! -z "$fname" ]; then
|
|
|
|
cp "$fname" "./etc/resolv.conf"
|
2019-03-06 10:03:12 +01:00
|
|
|
echo "etc/resolv.conf m 644 0 0" >> "$PKGDEPLOYDIR/pseudo"
|
2018-06-19 18:33:30 +02:00
|
|
|
fi
|
|
|
|
|
2018-06-16 17:46:17 +02:00
|
|
|
# gather rootfs dependencies
|
2019-02-03 17:13:28 +01:00
|
|
|
cat_file_merge "ROOTFS" | sort -u | \
|
|
|
|
xargs pkg install -om -R "$REPODIR" -r "$PKGBUILDDIR"
|
2018-01-16 17:44:43 +01:00
|
|
|
|
2019-02-03 17:13:28 +01:00
|
|
|
cat_file_merge "ROOTFS" | sort -u | \
|
|
|
|
xargs pkg install -R "$REPODIR" \
|
2019-03-06 10:03:12 +01:00
|
|
|
-r "$PKGBUILDDIR" -F sqfs -l >> "$PKGDEPLOYDIR/pseudo"
|
2018-01-18 14:23:48 +01:00
|
|
|
|
2018-02-09 13:05:48 +01:00
|
|
|
# setup root home directory
|
2018-06-16 17:46:17 +02:00
|
|
|
cp -r "$PKGBUILDDIR/etc/skel" "$PKGBUILDDIR/usr/root"
|
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
echo "usr/root m 700 0 0" >> "$PKGDEPLOYDIR/pseudo"
|
2018-02-09 13:05:48 +01:00
|
|
|
|
2018-06-16 17:46:17 +02:00
|
|
|
find "./usr/root" -exec stat {} --printf="%n m %a 0 0\\n" \; | \
|
2019-03-06 10:03:12 +01:00
|
|
|
sed 's#^./##g' | tail -n +2 >> "$PKGDEPLOYDIR/pseudo"
|
2018-01-18 14:23:48 +01:00
|
|
|
|
2018-04-19 07:23:15 +02:00
|
|
|
# move configuration to preserve directory
|
2018-06-16 17:46:17 +02:00
|
|
|
mv "$PKGBUILDDIR/etc" "$PKGBUILDDIR/cfg/preserve/etc"
|
|
|
|
mv "$PKGBUILDDIR/usr" "$PKGBUILDDIR/cfg/preserve/usr"
|
2018-04-19 07:23:15 +02:00
|
|
|
mv "$PKGBUILDDIR/var/lib" "$PKGBUILDDIR/cfg/preserve/var_lib"
|
|
|
|
rm -rf "$PKGBUILDDIR/var"
|
2018-01-23 16:34:33 +01:00
|
|
|
|
2018-06-16 17:46:17 +02:00
|
|
|
mkdir -p ${PKGBUILDDIR}/{etc,var,usr}
|
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
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"
|
2018-07-15 16:19:44 +02:00
|
|
|
|
|
|
|
# don't add stuff for the boot partition to the squashfs image
|
2019-03-06 10:03:12 +01:00
|
|
|
mv ${PKGBUILDDIR}/boot/* "$PKGDEPLOYDIR"
|
2018-07-15 16:19:44 +02:00
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
grep -v "^boot/" "$PKGDEPLOYDIR/pseudo" > "$PKGDEPLOYDIR/pseudo.temp"
|
|
|
|
mv "$PKGDEPLOYDIR/pseudo.temp" "$PKGDEPLOYDIR/pseudo"
|
|
|
|
echo "boot m 750 0 0" >> "$PKGDEPLOYDIR/pseudo"
|
2018-01-16 17:44:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
deploy() {
|
2019-03-06 10:03:12 +01:00
|
|
|
mksquashfs "$PKGBUILDDIR" "$PKGDEPLOYDIR/rootfs.img" -comp xz \
|
|
|
|
-no-progress -no-xattrs -pf "$PKGDEPLOYDIR/pseudo"
|
2018-04-20 13:12:57 +02:00
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
rm "$PKGDEPLOYDIR/pseudo"
|
|
|
|
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
|
2018-01-16 17:44:43 +01:00
|
|
|
}
|
2018-05-06 17:23:31 +02:00
|
|
|
|
|
|
|
check_update() {
|
|
|
|
return
|
2018-06-16 17:46:17 +02:00
|
|
|
}
|