1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-14 23:47:11 +01:00
build/pkg/init-scripts/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

113 lines
3 KiB
Text
Executable file

VERSION="4"
SRCDIR="init-scripts-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="http://infraroot.at/pygos"
SHA256SUM="dbfc67b01376d6607c69bc845c31e2f792f20773c829973ae6bfb57ac30699ae"
DEPENDS="toolchain"
build() {
local extra_flags=""
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$PKGDEPLOYDIR"
include_merge "INIT"
if [ "x$HWCLOCK" != "xyes" ]; then
extra_flags="$extra_flags --enable-swclock"
cat <<_EOF >> "$PKGDEPLOYDIR/$PKGNAME.files"
dir etc 0755 0 0
dir etc/crontab.d 0755 0 0
file etc/crontab.d/swclock 0644 0 0
slink etc/init.d/swclock 0777 0 0 /share/init/swclock
slink etc/init.d/swclocksave@reboot 0777 0 0 /share/init/swclocksave
slink etc/init.d/swclocksave@shutdown 0777 0 0 /share/init/swclocksave
file share/init/swclock 0644 0 0
file share/init/swclocksave 0644 0 0
dir var 0755 0 0
dir var/lib 0755 0 0
file var/lib/swclock 0644 0 0
_EOF
fi
if [ ! -z "$DHCP_PORTS" ]; then
extra_flags="$extra_flags --enable-dhcpclient"
cat <<_EOF >> "$PKGDEPLOYDIR/$PKGNAME.files"
slink etc/init.d/dhcpcdmaster 0777 0 0 /share/init/dhcpcdmaster
file share/init/dhcpcd 0644 0 0
file share/init/dhcpcdmaster 0644 0 0
_EOF
if [ "x$HWCLOCK" != "xyes" ]; then
cat <<_EOF >> "$PKGDEPLOYDIR/$PKGNAME.files"
dir lib/libexec/dhcpcd-hooks 0755 0 0
file lib/libexec/dhcpcd-hooks/40-ntpsetdate 0644 0 0
_EOF
fi
fi
run_configure "$1" "$extra_flags"
unset -v i GETTY_TTY HWCLOCK DHCP_PORTS SERVICES MODULES
}
deploy() {
local svc
make DESTDIR="$PKGDEPLOYDIR" install
include_merge "INIT"
if [ "x$HWCLOCK" == "xyes" ]; then
SERVICES="$SERVICES hwclock"
else
mkdir -p "$PKGDEPLOYDIR/var/lib"
date --utc +%m%d%H%M%Y.%S > "$PKGDEPLOYDIR/var/lib/swclock"
fi
svc=$(file_path_override "ifrename")
if [ ! -z "$svc" ]; then
cp "$svc" "$PKGDEPLOYDIR/etc/netcfg/ifrename"
SERVICES="$SERVICES ifrename"
fi
svc=$(file_path_override "nftables.rules")
if [ ! -z "$svc" ]; then
cp "$svc" "$PKGDEPLOYDIR/etc/nftables.rules"
echo "file etc/nftables.rules 0644 0 0" >> "$PKGDEPLOYDIR/$PKGNAME.files"
SERVICES="$SERVICES nft"
fi
svc=$(file_path_override "sysctl.conf")
if [ ! -z "$svc" ]; then
cp "$svc" "$PKGDEPLOYDIR/etc/sysctl.conf"
echo "file etc/sysctl.conf 0644 0 0" >> "$PKGDEPLOYDIR/$PKGNAME.files"
fi
svc=$(file_path_override "netcfg_static")
if [ ! -z "$svc" ]; then
mkdir -p "$PKGDEPLOYDIR/etc/netcfg"
cp "$svc" "$PKGDEPLOYDIR/etc/netcfg/static"
echo "file etc/netcfg/static 0644 0 0" >> "$PKGDEPLOYDIR/$PKGNAME.files"
fi
for svc in $GETTY_TTY; do
echo "slink etc/init.d/agetty@$svc 0777 0 0 /share/init/agetty" >> "$PKGDEPLOYDIR/$PKGNAME.files"
done
if [ ! -z "$DHCP_PORTS" ]; then
for svc in $DHCP_PORTS; do
echo "slink etc/init.d/dhcpcd@$svc 0777 0 0 /share/init/dhcpcd" >> "$PKGDEPLOYDIR/$PKGNAME.files"
done
fi
for svc in $SERVICES; do
echo "slink etc/init.d/$svc 0777 0 0 /share/init/$svc" >> "$PKGDEPLOYDIR/$PKGNAME.files"
done
touch "$PKGDEPLOYDIR/etc/modules"
for svc in $MODULES; do
echo "$svc" >> "$PKGDEPLOYDIR/etc/modules"
done
unset -v i GETTY_TTY HWCLOCK DHCP_PORTS SERVICES MODULES
}