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 3dc8e567c0 Bump init scripts version
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-25 20:19:58 +01:00

126 lines
2.9 KiB
Text
Executable file

VERSION="2"
SRCDIR="init-scripts-${VERSION}"
TARBALL="${SRCDIR}.tar.xz"
URL="http://infraroot.at/pygos"
SHA256SUM="7522e65dcd8dfc6bdb1dc4268e0198926580e422a254deb9cabd06b18a6c1b9e"
DEPENDS="toolchain"
prepare() {
return
}
build() {
local extra_flags=""
cp "$SCRIPTDIR/pkg/$PKGNAME/rootfs_files.txt" "./rootfs_files.txt"
include_merge "INIT"
if [ "x$HWCLOCK" != "xyes" ]; then
extra_flags="$extra_flags --enable-swclock"
cat <<_EOF >> "rootfs_files.txt"
etc/crontab.d/swclock m 644 0 0
etc/init.d/swclock m 777 0 0
etc/init.d/swclocksave@reboot m 777 0 0
etc/init.d/swclocksave@shutdown m 777 0 0
share/init/swclock m 444 0 0
share/init/swclocksave m 444 0 0
var/lib/swclock m 644 0 0
_EOF
fi
if [ ! -z "$DHCP_PORTS" ]; then
extra_flags="$extra_flags --enable-dhcpclient"
cat <<_EOF >> "rootfs_files.txt"
etc/init.d/dhcpcdmaster m 777 0 0
share/init/dhcpcd m 444 0 0
share/init/dhcpcdmaster m 444 0 0
_EOF
if [ "x$HWCLOCK" != "xyes" ]; then
cat <<_EOF >> "rootfs_files.txt"
lib/libexec/dhcpcd-hooks m 555 0 0
lib/libexec/dhcpcd-hooks/40-ntpsetdate m 444 0 0
_EOF
fi
fi
run_configure "$1" "$extra_flags"
unset -v i GETTY_TTY HWCLOCK DHCP_PORTS SERVICES MODULES
}
deploy() {
local SOURCE="$1"
local DEPLOY="$2"
local svc
make DESTDIR="$DEPLOY" install
cp "./rootfs_files.txt" "$DEPLOY"
include_merge "INIT"
if [ "x$HWCLOCK" == "xyes" ]; then
SERVICES="$SERVICES hwclock"
else
mkdir -p "$DEPLOY/var/lib"
date --utc +%m%d%H%M%Y.%S > "$DEPLOY/var/lib/swclock"
fi
svc=$(file_path_override "ifrename")
if [ ! -z "$svc" ]; then
cp "$svc" "$DEPLOY/etc/netcfg/ifrename"
SERVICES="$SERVICES ifrename"
fi
svc=$(file_path_override "nftables.rules")
if [ ! -z "$svc" ]; then
cp "$svc" "$DEPLOY/etc/nftables.rules"
echo "etc/nftables.rules m 644 0 0" >> "$DEPLOY/rootfs_files.txt"
SERVICES="$SERVICES nft"
fi
svc=$(file_path_override "sysctl.conf")
if [ ! -z "$svc" ]; then
cp "$svc" "$DEPLOY/etc/sysctl.conf"
echo "etc/sysctl.conf m 644 0 0" >> "$DEPLOY/rootfs_files.txt"
fi
svc=$(file_path_override "interfaces")
if [ ! -z "$svc" ]; then
for svc in $svc/*; do
[ -f "$svc" ] || continue
cp "$svc" "$DEPLOY/etc/netcfg/"
svc=$(basename $svc)
echo "etc/netcfg/$svc m 644 0 0" >> "$DEPLOY/rootfs_files.txt"
done
fi
for svc in $GETTY_TTY; do
ln -s "/share/init/agetty" "$DEPLOY/etc/init.d/agetty@$svc"
echo "etc/init.d/agetty@$svc m 777 0 0" >> "$DEPLOY/rootfs_files.txt"
done
if [ ! -z "$DHCP_PORTS" ]; then
for svc in $DHCP_PORTS; do
ln -s "/share/init/dhcpcd" "$DEPLOY/etc/init.d/dhcpcd@$svc"
echo "etc/init.d/dhcpcd@$svc m 777 0 0" >> "$DEPLOY/rootfs_files.txt"
done
fi
for svc in $SERVICES; do
ln -s "/share/init/$svc" "$DEPLOY/etc/init.d/$svc"
echo "etc/init.d/$svc m 777 0 0" >> "$DEPLOY/rootfs_files.txt"
done
touch "$DEPLOY/etc/modules"
for svc in $MODULES; do
echo "$svc" >> "$DEPLOY/etc/modules"
done
unset -v i GETTY_TTY HWCLOCK DHCP_PORTS SERVICES MODULES
}
check_update() {
return
}