From 64bca85513fded2398f197ffa572da92bf817a37 Mon Sep 17 00:00:00 2001 From: Stu Miller Date: Sat, 8 Feb 2020 08:42:01 +0700 Subject: system/autoslackpkg: Added (automates the use of slackpkg). Signed-off-by: Willy Sudiarto Raharjo --- system/autoslackpkg/README | 51 +++++++++++++++++++ system/autoslackpkg/autoslackpkg.SlackBuild | 79 +++++++++++++++++++++++++++++ system/autoslackpkg/autoslackpkg.info | 10 ++++ system/autoslackpkg/doinst.sh | 16 ++++++ system/autoslackpkg/slack-desc | 20 ++++++++ 5 files changed, 176 insertions(+) create mode 100644 system/autoslackpkg/README create mode 100644 system/autoslackpkg/autoslackpkg.SlackBuild create mode 100644 system/autoslackpkg/autoslackpkg.info create mode 100644 system/autoslackpkg/doinst.sh create mode 100644 system/autoslackpkg/slack-desc diff --git a/system/autoslackpkg/README b/system/autoslackpkg/README new file mode 100644 index 0000000000..52718e2507 --- /dev/null +++ b/system/autoslackpkg/README @@ -0,0 +1,51 @@ +autoslackpkg automates the use of slackpkg. The script expects to be run as +the root user. It also expects specific modifications to blacklist, +mkinitrd.conf, efi.conf & lilo.conf. + +The script maintains multiple kernels and manages EFI & LILO setups +(not GRUB yet). The default boot kernel is changed to the most recent kernel. +In the unlikely event the most recent kernel is not functioning properly the +system can be rebooted with the previous kernel. + +The script has a config file /etc/slackpkg/autoslackpkg.conf that sets +default variables. These variables can be changed based on unique system +requirements. + +The script requires options and arguments. To see usage help +run (autoslackpkg) without options or arguments. Usage help also is +displayed if there is a script option or argument error. + +When run with the -h option and a valid argument (autoslackpkg -h overview | +blacklist | elilo | lilo | mkinitrd) the script provides help. + +When run with the -m option and a valid argument (autoslackpkg -m dialog | +batch) the script runs in either dialog mode or batch mode. Dialog mode +is a hands-on, interactive mode. Batch mode runs without user input. + +When run with the -s option (autoslackpkg -s update | install-new | +upgrade-all | clean-system | install-kernel | remove-kernel | new-config) +the script only runs a specific section of the overall script. + +The script runs in 2 Phases. If not installing a new kernel then autoslackpkg +runs both Phase 1 & Phase 2 in succession. If a new kernel is installed then +only Phase 1 is run & reboot is required. After reboot, rerun autoslackpkg +then Phase 1 is skipped & only Phase 2 is run. + +Phase 1 includes: + + 1) slackpkg update + 2) slackpkg install-new + 3) slackpkg upgrade-all (see blacklist help) + 4) new kernel download & installation (see blacklist help) + 5) mkinitrd for new kernel (see mkitrd help) + 6) EFI system new kernel management (see elilo help) + 7) LILO system new kernel management (see lilo help) + +Phase 2 includes: + + 1) slackpkg clean-system + 2) EFI system old kernel management (see elilo help) + 3) LILO system old kernel management (see lilo help) + 4) run updatedb + 5) slackpkg new-config + 6) find /etc *.new & *.orig diff --git a/system/autoslackpkg/autoslackpkg.SlackBuild b/system/autoslackpkg/autoslackpkg.SlackBuild new file mode 100644 index 0000000000..cfa78322ee --- /dev/null +++ b/system/autoslackpkg/autoslackpkg.SlackBuild @@ -0,0 +1,79 @@ +#!/bin/sh + +# Slackware build script for autoslackpkg + +# Copyright 2019, 2020 Stu Miller, Colorado, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=autoslackpkg +VERSION=${VERSION:-1.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +ARCH=noarch + +CWD=$(pwd) +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.gz +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/doc/$PRGNAM-$VERSION +cp -a \ + CHANGELOG \ + README \ + $PKG/usr/doc/$PRGNAM-$VERSION/ +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/etc/slackpkg +cp -a \ + $PRGNAM.conf.new \ + $PKG/etc/slackpkg/ + +mkdir -p $PKG/usr/sbin +cp -a \ + $PRGNAM \ + $PKG/usr/sbin/ + +mkdir -p $PKG/usr/libexec/$PRGNAM +cp -a \ + libexec/* \ + $PKG/usr/libexec/$PRGNAM/ + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/autoslackpkg/autoslackpkg.info b/system/autoslackpkg/autoslackpkg.info new file mode 100644 index 0000000000..41a50203f7 --- /dev/null +++ b/system/autoslackpkg/autoslackpkg.info @@ -0,0 +1,10 @@ +PRGNAM="autoslackpkg" +VERSION="1.0" +HOMEPAGE="https://www.go4it2day.com/news/autoslackpkg-1.0.html" +DOWNLOAD="https://www.go4it2day.com/downloads/autoslackpkg/1.0/autoslackpkg-1.0.tar.gz" +MD5SUM="886df689f95c75b091e3bf4abc015a83" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Stu Miller" +EMAIL="slackbuilds@go4it2day.com" diff --git a/system/autoslackpkg/doinst.sh b/system/autoslackpkg/doinst.sh new file mode 100644 index 0000000000..fbcc100866 --- /dev/null +++ b/system/autoslackpkg/doinst.sh @@ -0,0 +1,16 @@ +# doinst.sh for autoslackpkg + +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... +} + +config etc/slackpkg/autoslackpkg.conf.new diff --git a/system/autoslackpkg/slack-desc b/system/autoslackpkg/slack-desc new file mode 100644 index 0000000000..f2c635f3e7 --- /dev/null +++ b/system/autoslackpkg/slack-desc @@ -0,0 +1,20 @@ +# 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------------------------------------------------------| +autoslackpkg: autoslackpkg (automates the use of slackpkg) +autoslackpkg: +autoslackpkg: To see autoslackpkg usage run: autoslackpkg +autoslackpkg: +autoslackpkg: Home: https://www.go4it2day.com/news/autoslackpkg-1.0.html +autoslackpkg: +autoslackpkg: +autoslackpkg: +autoslackpkg: +autoslackpkg: +autoslackpkg: +autoslackpkg: -- cgit v1.2.3