1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-23 03:29:46 +01:00
build/pkg/init-scripts/build
David Oberhollenzer e0de98bf7d Bump init version
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-29 21:03:09 +01:00

124 lines
3.1 KiB
Text
Executable file

VERSION="3"
SRCDIR="init-scripts-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="http://infraroot.at/pygos"
SHA256SUM="529f91c59cecda5bbe954e73bbddddaa22e80ac49e85b7bb785c3cee2397f070"
DEPENDS="toolchain"
prepare() {
return
}
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 "interfaces")
if [ ! -z "$svc" ]; then
for svc in $svc/*; do
[ -f "$svc" ] || continue
cp "$svc" "$PKGDEPLOYDIR/etc/netcfg/"
svc=$(basename $svc)
echo "file etc/netcfg/$svc 0644 0 0" >> "$PKGDEPLOYDIR/$PKGNAME.files"
done
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
}
check_update() {
return
}