1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-22 11:09:46 +01:00
build/pkg/init-scripts/build
David Oberhollenzer d2432c1d1e Use pkg for managing binaries and their dependencies
- rewrite the rootfs_files.txt listings to the format used by pkg
 - create package files from each package
 - use "pkg install" to manage installation of packages and dependencies
   into the rootfs and initrd staging dirs

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-03 17:47:02 +01:00

128 lines
3.1 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 SOURCE="$1"
local DEPLOY="$2"
local extra_flags=""
cp $SCRIPTDIR/pkg/$PKGNAME/*.{files,desc} "$DEPLOY"
include_merge "INIT"
if [ "x$HWCLOCK" != "xyes" ]; then
extra_flags="$extra_flags --enable-swclock"
cat <<_EOF >> "$DEPLOY/$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 >> "$DEPLOY/$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 >> "$DEPLOY/$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 SOURCE="$1"
local DEPLOY="$2"
local svc
make DESTDIR="$DEPLOY" install
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 "file etc/nftables.rules 0644 0 0" >> "$DEPLOY/$PKGNAME.files"
SERVICES="$SERVICES nft"
fi
svc=$(file_path_override "sysctl.conf")
if [ ! -z "$svc" ]; then
cp "$svc" "$DEPLOY/etc/sysctl.conf"
echo "file etc/sysctl.conf 0644 0 0" >> "$DEPLOY/$PKGNAME.files"
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 "file etc/netcfg/$svc 0644 0 0" >> "$DEPLOY/$PKGNAME.files"
done
fi
for svc in $GETTY_TTY; do
echo "slink etc/init.d/agetty@$svc 0777 0 0 /share/init/agetty" >> "$DEPLOY/$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" >> "$DEPLOY/$PKGNAME.files"
done
fi
for svc in $SERVICES; do
echo "slink etc/init.d/$svc 0777 0 0 /share/init/$svc" >> "$DEPLOY/$PKGNAME.files"
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
}