aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-09-14 18:31:48 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2019-09-14 18:31:48 +0200
commit5d6f0ade42657c55502cb150e5f957f1207ea1df (patch)
treedf26cafd854274ceda7c7280002b7caa07df805e
parent79003656b4a3e1cc69d36f5e49dc066547edf708 (diff)
downloadslackupgrade-5d6f0ade42657c55502cb150e5f957f1207ea1df.tar.gz
slackupgrade-5d6f0ade42657c55502cb150e5f957f1207ea1df.tar.bz2
Use a unique temporary directory
-rw-r--r--slackware-upgrade-system32
1 files changed, 23 insertions, 9 deletions
diff --git a/slackware-upgrade-system b/slackware-upgrade-system
index 1958935..3509a9c 100644
--- a/slackware-upgrade-system
+++ b/slackware-upgrade-system
@@ -37,9 +37,21 @@ install_series=
keep_file=
# Internal variables
-installed_list=/tmp/installed.list.$$
-avail_index=/tmp/avail.index.$$
-avail_list=/tmp/avail.list.$$
+tempdir=${TMP:-/tmp}/slackupg.$$
+installed_list=$tempdir/installed.list
+avail_index=$tempdir/avail.index
+avail_list=$tempdir/avail.list
+
+function tempdir_create() {
+ u=$(umask)
+ umask 077
+ mkdir $tempdir
+ umask $u
+}
+
+function tempdir_remove() {
+ rm -rf $tempdir
+}
function usage() {
cat <<EOF
@@ -185,7 +197,9 @@ if [ ! -d $pkgdir ]; then
exit 1
fi
-tmplist=/tmp/$$
+tempdir_create
+
+tmplist=$tempdir/$$
cat > $tmplist <<EOF
CHECKSUMS.md5
CHECKSUMS.md5.asc
@@ -201,6 +215,7 @@ rm $tmplist
if [ -n "$missing" ]; then
echo >&2 "$0: The following required files are missing in $pkgdir:"
echo >&2 "$missing"
+ tempdir_remove
exit 1
fi
@@ -229,6 +244,7 @@ rm $tmplist
if [ -n "$missing" ]; then
echo >&2 "$0: The following required directories are missing in $pkgdir:"
echo >&2 "$missing"
+ tempdir_remove
exit 1
fi
@@ -262,7 +278,6 @@ fi
if [ -z "$install_all" ]; then
candidates=$(comm -1 -2 $installed_list $avail_list)
fi
-rm -f $installed_list $avail_list
# Disable interrupts during critical section
trap '' HUP INT QUIT ABRT
@@ -278,7 +293,7 @@ cat $remove_list) | ${PAGER:-more}
fi
if ! getyn n "Ready for upgrade from $VERSION to $newversion. Continue"; then
- rm -f $avail_index
+ tempdir_remove
echo "Exiting"
exit 0
fi
@@ -320,9 +335,6 @@ fi | \
upgrade_package --install-new $pkg
done
-# Index is not needed any more
-rm -f $avail_index
-
if [ -s $remove_list ]; then
echo "$0: removing packages"
if [ -n "$dry_run" ]; then
@@ -337,6 +349,8 @@ fi
echo "$0: upgrade finished; see $logfile for details"
+tempdir_remove
+
conffiles=$logstem.conffiles
find /etc /usr/lib*/ /usr/share/vim -name "*.new" 2>/dev/null | \
sort > $conffiles

Return to:

Send suggestions and report system problems to the System administrator.