Browse Source

Use buildin bash tricks instead of basename

Restore working directory after --sync
Georgi Chorbadzhiyski 18 years ago
parent
commit
3abda577f7
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      slcheck.sh

+ 4
- 2
slcheck.sh View File

@@ -1,7 +1,7 @@
1 1
 #!/bin/sh
2 2
 # SlackCheck
3 3
 #
4
-# $Id: slcheck.sh,v 1.32 2006/07/06 15:01:49 gf Exp $
4
+# $Id: slcheck.sh,v 1.33 2006/07/06 23:42:06 gf Exp $
5 5
 #
6 6
 # Copyright (c) 2002-2006 Georgi Chorbadzhiyski, Sofia, Bulgaria
7 7
 # All rights reserved.
@@ -81,6 +81,7 @@ usage() {
81 81
 # Get newest package list
82 82
 sync_master_list() {
83 83
 	echo "===> Getting newest package list..."
84
+	WD=$(pwd)
84 85
 	mkdir $DIR_PKG 2>/dev/null
85 86
 	cd $DIR_PKG
86 87
 	TMPDIR=".Tmp"
@@ -98,6 +99,7 @@ sync_master_list() {
98 99
 	fi
99 100
 	cd ..
100 101
 	rm -rf $TMPDIR 2>/dev/null
102
+	cd $WD
101 103
 }
102 104
 
103 105
 # Generate list of packages for every host
@@ -153,7 +155,7 @@ generate_upgrade_scripts() {
153 155
 				distro_package=$(grep /$basepkg-[0-9] ${DIR_PKG}/${FILE_NEWEST})
154 156
 				if [ "$distro_package" != "" ]
155 157
 				then # Host package exist in the distro packages
156
-					distropkg=$(basename $distro_package) # Strip directory
158
+					distropkg="${distro_package##*/}" # Faster basename using build-in BASH tricks
157 159
 					if [ "$distropkg" != "$hostpkg" ]
158 160
 					then
159 161
 						if [ "$VERBOSE" != "1" ]; then

Loading…
Cancel
Save