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() {
|
|
|
|
local SOURCE="$1"
|
2018-02-16 23:22:04 +01:00
|
|
|
local DEPLOY="$2"
|
2018-01-16 17:44:43 +01:00
|
|
|
|
|
|
|
# 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"
|
2018-06-16 17:46:17 +02:00
|
|
|
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
|
2018-02-05 14:04:27 +01:00
|
|
|
|
2018-06-16 17:46:17 +02:00
|
|
|
echo "etc/$fname m 644 0 0" >> "$DEPLOY/pseudo"
|
|
|
|
|
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"
|
|
|
|
echo "etc/resolv.conf m 644 0 0" >> "$DEPLOY/pseudo"
|
|
|
|
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" \
|
|
|
|
-r "$PKGBUILDDIR" -F sqfs -l >> "$DEPLOY/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"
|
|
|
|
|
2018-09-15 20:25:27 +02:00
|
|
|
echo "usr/root m 700 0 0" >> "$DEPLOY/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" \; | \
|
|
|
|
sed 's#^./##g' | tail -n +2 >> "$DEPLOY/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}
|
|
|
|
|
|
|
|
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"
|
2018-07-15 16:19:44 +02:00
|
|
|
|
|
|
|
# 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"
|
2018-01-16 17:44:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
deploy() {
|
|
|
|
local SOURCE="$1"
|
2018-02-16 23:22:04 +01:00
|
|
|
local DEPLOY="$2"
|
2018-01-16 17:44:43 +01:00
|
|
|
|
2018-02-22 19:51:44 +01:00
|
|
|
mksquashfs "$PKGBUILDDIR" "$DEPLOY/rootfs.img" -comp xz \
|
2018-06-16 17:46:17 +02:00
|
|
|
-no-progress -no-xattrs -pf "$DEPLOY/pseudo"
|
2018-04-20 13:12:57 +02:00
|
|
|
|
2018-06-16 17:46:17 +02:00
|
|
|
rm "$DEPLOY/pseudo"
|
2019-02-08 00:02:42 +01:00
|
|
|
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$DEPLOY"
|
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
|
|
|
}
|