diff options
author | Patrick J Volkerding <volkerdi@slackware.com> | 2016-06-30 20:26:57 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2018-05-31 23:31:18 +0200 |
commit | d31c50870d0bee042ce660e445c9294a59a3a65b (patch) | |
tree | 6bfc0de3c95267b401b620c2c67859557dc60f97 /source/a/pkgtools/scripts/removepkg | |
parent | 76fc4757ac91ac7947a01fb7b53dddf9a78a01d1 (diff) | |
download | current-d31c50870d0bee042ce660e445c9294a59a3a65b.tar.gz current-d31c50870d0bee042ce660e445c9294a59a3a65b.tar.xz |
Slackware 14.2slackware-14.2
Thu Jun 30 20:26:57 UTC 2016
Slackware 14.2 x86_64 stable is released!
The long development cycle (the Linux community has lately been living in
"interesting times", as they say) is finally behind us, and we're proud to
announce the release of Slackware 14.2. The new release brings many updates
and modern tools, has switched from udev to eudev (no systemd), and adds
well over a hundred new packages to the system. Thanks to the team, the
upstream developers, the dedicated Slackware community, and everyone else
who pitched in to help make this release a reality.
The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided
32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware
project by picking up a copy from store.slackware.com. We're taking
pre-orders now, and offer a discount if you sign up for a subscription.
Have fun! :-)
Diffstat (limited to 'source/a/pkgtools/scripts/removepkg')
-rw-r--r-- | source/a/pkgtools/scripts/removepkg | 63 |
1 files changed, 14 insertions, 49 deletions
diff --git a/source/a/pkgtools/scripts/removepkg b/source/a/pkgtools/scripts/removepkg index 8b5a911dd..2813fc3c5 100644 --- a/source/a/pkgtools/scripts/removepkg +++ b/source/a/pkgtools/scripts/removepkg @@ -1,6 +1,12 @@ #!/bin/sh # Slackware remove package script # +# Thu Sep 24 03:31:58 UTC 2015 <alphageek> +# extract_links() sed adjusted to handle symlinks with spaces. +# +# Sun Sep 6 21:58:36 BST 2009 +# Replaced pkgbase & package_name code with 'sed' script by Jim Hawkins. +# # Sat Apr 25 21:18:53 UTC 2009 (12.34567890b) # Converted to use new pkgbase() function to remove pathname and # valid package extensions. @@ -72,7 +78,7 @@ # Copyright 1994, 1995, 1998 Patrick Volkerding, Moorhead, Minnesota USA # Copyright 2001, Slackware Linux, Inc., Concord, CA USA -# Copyright 2009 Patrick J. Volkerding, Sebeka, MN, USA +# Copyright 2009, 2015 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -96,25 +102,8 @@ # Return a package name that has been stripped of the dirname portion # and any of the valid extensions (only): pkgbase() { - PKGEXT=$(echo $1 | rev | cut -f 1 -d . | rev) - case $PKGEXT in - 'tgz' ) - PKGRETURN=$(basename $1 .tgz) - ;; - 'tbz' ) - PKGRETURN=$(basename $1 .tbz) - ;; - 'tlz' ) - PKGRETURN=$(basename $1 .tlz) - ;; - 'txz' ) - PKGRETURN=$(basename $1 .txz) - ;; - *) - PKGRETURN=$(basename $1) - ;; - esac - echo $PKGRETURN + # basename + strip extensions .tbz, .tgz, .tlz and .txz + echo "$1" | sed 's?.*/??;s/\.t[bglx]z$//' } # This makes "sort" run much faster: @@ -149,7 +138,7 @@ cat_except() { } extract_links() { - sed -n 's,^( *cd \([^ ;][^ ;]*\) *; *rm -rf \([^ )][^ )]*\) *) *$,\1/\2,p' + sed -n 's,^[ ]*( [ ]*cd[ ]* \(.*\) [ ]*; [ ]*rm [ ]*-rf[ ]* \(.*\) [ ]*)[ ]*$,\1/\2,p' } preserve_file() { @@ -228,7 +217,7 @@ delete_links() { if [ -L "$ROOT/$LINK" ]; then if [ ! "$WARN" = "true" ]; then echo " --> Deleting symlink $ROOT/$LINK" - rm -f $ROOT/$LINK + rm -f "$ROOT/$LINK" else echo " --> $ROOT/$LINK (symlink) would be deleted" fi @@ -271,38 +260,14 @@ delete_cats() { } package_name() { - STRING=$(pkgbase $1) + STRING=$(pkgbase $1 | sed 's?-[^-]*-[^-]*-[^-]*$??') # If we don't do this, commands run later will take the '-' to be an option # and will destroy the package database. Packages should not contain spaces # in them. Normally this type of problem results from a command line typo. if [ "$(echo $STRING | cut -b 1)" = "-" ]; then STRING="malformed-package-name-detected" fi - # Check for old style package name with one segment: - if [ "$(echo $STRING | cut -f 1 -d -)" = "$(echo $STRING | cut -f 2 -d -)" ]; then - echo $STRING - else # has more than one dash delimited segment - # Count number of segments: - INDEX=1 - while [ ! "$(echo $STRING | cut -f $INDEX -d -)" = "" ]; do - INDEX=$(expr $INDEX + 1) - done - INDEX=$(expr $INDEX - 1) # don't include the null value - # If we don't have four segments, return the old-style (or out of spec) package name: - if [ "$INDEX" = "2" -o "$INDEX" = "3" ]; then - echo $STRING - else # we have four or more segments, so we'll consider this a new-style name: - NAME=$(expr $INDEX - 3) - NAME="$(echo $STRING | cut -f 1-$NAME -d -)" - echo $NAME - # cruft for later ;) - #VER=$(expr $INDEX - 2) - #VER="$(echo $STRING | cut -f $VER -d -)" - #ARCH=$(expr $INDEX - 1) - #ARCH="$(echo $STRING | cut -f $ARCH -d -)" - #BUILD="$(echo $STRING | cut -f $INDEX -d -)" - fi - fi + echo $STRING } # Conversion to 'comm' utility by Mark Wisdom. @@ -329,7 +294,7 @@ remove_packages() { fi if [ ! -e $ADM_DIR/packages/$PKGNAME ]; then - long_package=$(ls -1 $ADM_DIR/packages/${PKGNAME}* | grep -m 1 "${PKGNAME}-[^-]*-[^-]*-[^-]*$") + long_package=$(ls -1 $ADM_DIR/packages/${PKGNAME}* | grep -m 1 "^${PKGNAME}-[^-]*-[^-]*-[^-]*$") if [ -e "$long_package" ]; then PKGNAME=$(basename $long_package) fi |