From 4246117f547875326066feb6634eff4da3aa25ce Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Wed, 22 Nov 2017 22:47:12 +0100 Subject: 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. --- make_slackware_live.sh | 72 ++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 32 deletions(-) (limited to 'make_slackware_live.sh') 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 -- cgit v1.2.3