1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-14 23:47:11 +01:00
build/pkg/rootfs/build
David Oberhollenzer fa4eff263b Cleanup: implement defaults for package functions
This commit adds an "emptypackage" template that implements defaults
for all package functions and is included before every package.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-04-16 15:16:58 +02:00

37 lines
1 KiB
Text
Executable file

DEPENDS=$(cat_file_merge "ROOTFS" | sort -u)
build() {
local listing="$PKGDEPLOYDIR/$PKGNAME.files"
local desc="$PKGDEPLOYDIR/$PKGNAME.desc"
# generate package description and file listing
pkg install -l pkg -r "$SYSROOT" $DEPENDS | sort -u > "$listing"
touch "$desc"
# move configuration to preserve directory
mkdir -pv "$SYSROOT/cfg/preserve" "$SYSROOT/cfg/overlay"
mv "$SYSROOT/etc" "$SYSROOT/cfg/preserve/etc"
mv "$SYSROOT/usr" "$SYSROOT/cfg/preserve/usr"
mv "$SYSROOT/var/lib" "$SYSROOT/cfg/preserve/var_lib"
rm -rf "$SYSROOT/var"
sed -i 's#etc/#cfg/preserve/etc/#g' "$listing"
sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$listing"
sed -i 's#usr/#cfg/preserve/usr/#g' "$listing"
egrep -v "^(dir|file|slink) (var|etc|usr)" "$listing" > "./temp"
mv "./temp" "$listing"
cat <<_EOF >> "$listing"
dir etc 0755 0 0
dir var 0755 0 0
dir usr 0755 0 0
dir cfg 0755 0 0
dir cfg/preserve 0755 0 0
dir cfg/preserve/etc 0755 0 0
dir cfg/preserve/usr 0755 0 0
dir cfg/preserve/var_lib 0755 0 0
dir cfg/overlay 0755 0 0
_EOF
}