system/efi-sync: Added (EFI auto update).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Slack Coder 2024-05-04 09:24:32 +09:00 committed by Willy Sudiarto Raharjo
parent f4116510b0
commit c67b91cac9
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
6 changed files with 195 additions and 0 deletions

19
system/efi-sync/README Normal file
View File

@ -0,0 +1,19 @@
efi-sync is a program which will update your efi when your kernel or its
related files are updated.
To have efi-sync to start and stop with your host, add to the beginning of
/etc/rc.d/rc.local:
if [ -x /etc/rc.d/rc.efi-sync ]; then
/etc/rc.d/rc.efi-sync start
fi
and to /etc/rc.d/rc.local_shutdown (creating it if needed):
if [ -x /etc/rc.d/rc.efi-sync ]; then
/etc/rc.d/rc.efi-sync stop
fi
Also ensure your EFI is mounted on boot by having its entry configured in
/etc/fstab. For more instructions, refer to the project's README in this
packages documentation under /usr/doc.

25
system/efi-sync/doinst.sh Normal file
View File

@ -0,0 +1,25 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
preserve_perms etc/rc.d/rc.efi-sync.new

View File

@ -0,0 +1,62 @@
#!/bin/bash
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=efi-sync
VERSION=${VERSION:-0.2.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
mkdir -p $PKG/usr/sbin
cp efi-sync $PKG/usr/sbin/
chmod +x $PKG/usr/sbin/efi-sync
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cp -a \
README.md \
$PKG/usr/doc/$PRGNAM-$VERSION
cp "$CWD/README" "$PKG/usr/doc/$PRGNAM-$VERSION/README_slackware.md"
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
mkdir -p "$PKG/etc/rc.d"
cp -R "$CWD/files/rc.efi-sync.new" "$PKG/etc/rc.d/"
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-0.2.0-$ARCH-$BUILD$TAG.$PKGTYPE

View File

@ -0,0 +1,10 @@
PRGNAM="efi-sync"
VERSION="0.2.0"
HOMEPAGE="https://git.server.ky/slackcoder/efi-sync"
DOWNLOAD="https://git.server.ky/slackcoder/efi-sync/snapshot/efi-sync-0.2.0.tar.xz"
MD5SUM="9da8ebe6f6bcf30e0b8304c641c72396"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="Slack Coder"
EMAIL="slackcoder@server.ky"

View File

@ -0,0 +1,60 @@
#!/bin/sh
#
# Startup/shutdown script for GNU Taler's exchange.
#
# Seconds to wait for daemon to shutdown.
SHUTDOWN_WAIT=60
mkdir -p /run/efi-sync
start() {
echo "Starting EFI Sync"
daemon \
--name=efi-sync \
--pidfiles=/run/efi-sync \
--output=/var/log/efi-sync.log \
-- efi-sync watch
}
stop() {
echo "Stopping EFI Sync"
if /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running ; then
/usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --stop
fi
# Wait for daemon to politely shutdown.
sleep 1
if /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running; then
echo "Waiting up to ${SHUTDOWN_WAIT} to stop..."
let "count = 0"
while /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running && [[ $count -lt 60 ]]; do
sleep 1
let "count = $count + 1"
done
fi
}
status() {
if /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running ; then
/usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running --verbose
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|status}"
exit 1
esac

View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
efi-sync: efi-sync (Kernel EFI installer)
efi-sync:
efi-sync: Automatically install your kernel into the EFI on updates.
efi-sync:
efi-sync:
efi-sync:
efi-sync:
efi-sync:
efi-sync:
efi-sync:
efi-sync: