summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2017-11-22 22:47:12 +0100
committer Eric Hameleers <alien@slackware.com>2017-11-22 22:47:12 +0100
commit4246117f547875326066feb6634eff4da3aa25ce (patch)
treece73bf8b5d7750ec8ae28e16d17c055382ee3e1f
parent65a1cc3ee3df6baad39ec736583c39f7256a6bd3 (diff)
downloadliveslak-4246117f547875326066feb6634eff4da3aa25ce.tar.gz
liveslak-4246117f547875326066feb6634eff4da3aa25ce.tar.xz
Add support for removing packages in a subsequent squashfs module
A pkglist has a certain syntax: - Lines starting with '#' are considered comments and are ignored. - Empty lines will be ignored. - A line not containing '%' is considered to name a single package to install/upgrade. - Two strings separated by '%' are considered as 'old' and 'new' package where the old package will be upgraded by the new package. This is useful in situations where the package names differ (udev -> eudev). - One string with '%' at the end is considered a package removal request. The string in front of the '%' is the package name to be removed. This syntax was added in liveslak-1.1.9.3.
-rwxr-xr-xmake_slackware_live.sh72
1 files changed, 40 insertions, 32 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh
index 4102500..d66c299 100755
--- a/make_slackware_live.sh
+++ b/make_slackware_live.sh
@@ -390,44 +390,52 @@ function install_pkgs() {
for PKGPAT in $(cat ${PKGFILE} |grep -v -E '^ *#|^$' |cut -d: -f1); do
# Extract the name of the package to install:
PKG=$(echo $PKGPAT |cut -d% -f2)
- # Extract the name of the potential package to replace; if there is
- # no package to replace then the 'cut' will make REP equal to PKG:
+ # Extract the name of the potential package to replace/remove:
+ # - If there is no package to replace then the 'cut' will make
+ # REP equal to PKG.
+ # - If PKG is empty then this is a request to remove the package.
REP=$(echo $PKGPAT |cut -d% -f1)
- # Look in ./patches ; then ./${DISTRO}$DIRSUFFIX ; then ./extra
- # Need to escape any '+' in package names such a 'gtk+2':
- if [ ! -z "${SL_PATCHROOT}" ]; then
- FULLPKG=$(full_pkgname ${PKG} ${SL_PATCHROOT})
+ if [ -z "${PKG}" ]; then
+ # Package removal:
+ ROOT="$2" removepkg "${REP}"
else
- FULLPKG=""
- fi
- if [ "x${FULLPKG}" = "x" ]; then
- FULLPKG=$(full_pkgname ${PKG} ${SL_PKGROOT})
- else
- echo "-- $PKG found in patches"
- fi
- if [ "x${FULLPKG}" = "x" ]; then
- # One last attempt: look in ./extra
- FULLPKG=$(full_pkgname ${PKG} $(dirname ${SL_PKGROOT})/extra)
- fi
+ # Package install/upgrade:
+ # Look in ./patches ; then ./${DISTRO}$DIRSUFFIX ; then ./extra
+ # Need to escape any '+' in package names such a 'gtk+2'.
+ if [ ! -z "${SL_PATCHROOT}" ]; then
+ FULLPKG=$(full_pkgname ${PKG} ${SL_PATCHROOT})
+ else
+ FULLPKG=""
+ fi
+ if [ "x${FULLPKG}" = "x" ]; then
+ FULLPKG=$(full_pkgname ${PKG} ${SL_PKGROOT})
+ else
+ echo "-- $PKG found in patches"
+ fi
+ if [ "x${FULLPKG}" = "x" ]; then
+ # One last attempt: look in ./extra
+ FULLPKG=$(full_pkgname ${PKG} $(dirname ${SL_PKGROOT})/extra)
+ fi
- if [ "x${FULLPKG}" = "x" ]; then
- echo "-- Package $PKG was not found in $(dirname ${SL_REPO}) !"
- else
- # Determine if we need to install or upgrade a package:
- for INSTPKG in $(ls -1 "$2"/var/log/packages/${REP}-* 2>/dev/null |rev |cut -d/ -f1 |cut -d- -f4- |rev) ; do
+ if [ "x${FULLPKG}" = "x" ]; then
+ echo "-- Package $PKG was not found in $(dirname ${SL_REPO}) !"
+ else
+ # Determine if we need to install or upgrade a package:
+ for INSTPKG in $(ls -1 "$2"/var/log/packages/${REP}-* 2>/dev/null |rev |cut -d/ -f1 |cut -d- -f4- |rev) ; do
+ if [ "$INSTPKG" = "$REP" ]; then
+ break
+ fi
+ done
if [ "$INSTPKG" = "$REP" ]; then
- break
- fi
- done
- if [ "$INSTPKG" = "$REP" ]; then
- if [ "$PKG" = "$REP" ]; then
- ROOT="$2" upgradepkg --reinstall "${FULLPKG}"
+ if [ "$PKG" = "$REP" ]; then
+ ROOT="$2" upgradepkg --reinstall "${FULLPKG}"
+ else
+ # We need to replace one package (REP) with another (FULLPKG):
+ ROOT="$2" upgradepkg "${REP}%${FULLPKG}"
+ fi
else
- # We need to replace one package (REP) with another (FULLPKG):
- ROOT="$2" upgradepkg "${REP}%${FULLPKG}"
+ installpkg --terse --root "$2" "${FULLPKG}"
fi
- else
- installpkg --terse --root "$2" "${FULLPKG}"
fi
fi
done