summaryrefslogtreecommitdiffstats
path: root/make_slackware_live.sh
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2016-12-13 23:11:25 +0100
committer Eric Hameleers <alien@slackware.com>2016-12-13 23:11:25 +0100
commit73f6bb19a6a9b5e2dcbf392a259dbbe68bed5dca (patch)
treeb4a2505f2020d41f4a51c66e12ff26f73c9aa7d1 /make_slackware_live.sh
parentf9fec3d3f989359ed3bdf3bbf256891b3add5779 (diff)
downloadliveslak-73f6bb19a6a9b5e2dcbf392a259dbbe68bed5dca.tar.gz
liveslak-73f6bb19a6a9b5e2dcbf392a259dbbe68bed5dca.tar.xz
Make it possible to replace a package instead of simply upgrading it.
Example: Replace eudev with systemd (actual request made by Dlackware). The package list should then contain the following line: eudev%systemd I.e. the package to be replaced, followed by a '%', followed by the name of the package that replaces the original. This is similar syntax to the way in which you tell upgradepkg to replace one package with another bearing a different name.
Diffstat (limited to 'make_slackware_live.sh')
-rwxr-xr-xmake_slackware_live.sh20
1 files changed, 15 insertions, 5 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh
index a11a617..7cee8e3 100755
--- a/make_slackware_live.sh
+++ b/make_slackware_live.sh
@@ -353,7 +353,12 @@ function install_pkgs() {
fi
fi
- for PKG in $(cat ${PKGFILE} |grep -v -E '^ *#|^$' |cut -d: -f1); do
+ 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:
+ 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
@@ -375,13 +380,18 @@ function install_pkgs() {
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/${PKG}-* 2>/dev/null |rev |cut -d/ -f1 |cut -d- -f4- |rev) ; do
- if [ "$INSTPKG" = "$PKG" ]; then
+ 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" = "$PKG" ]; then
- ROOT="$2" upgradepkg --reinstall "${FULLPKG}"
+ if [ "$INSTPKG" = "$REP" ]; then
+ 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
installpkg --terse --root "$2" "${FULLPKG}"
fi