From 89b7b67a13ebb7965cc7f13ad0595e2194a2d34c Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 15:48:04 +0200 Subject: add sqmail-4.2.29a --- package/upgrade | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100755 package/upgrade (limited to 'package/upgrade') diff --git a/package/upgrade b/package/upgrade new file mode 100755 index 0000000..ff26087 --- /dev/null +++ b/package/upgrade @@ -0,0 +1,117 @@ +#!/bin/sh + +shout() { echo "$0: $@" >&2; } +barf() { shout "fatal: $@"; exit 111; } +safe() { "$@" || barf "cannot $@"; } + +safe umask 022 +[ -d package ] || barf "no package directory" +[ -d src ] || barf "no src directory" +[ -d compile ] || barf "no compile directory" + +for i in `sed -e '/^it-/!d' -e 's/^it-//' < compile/it=d` +do + all="$all $i" +done + +usage() { shout "usage: package/upgrade [ [-]$all ]"; exit 100; } + +targets="" +if [ $# -eq 0 ] +then + for i in $all + do + targets="$all" + done +else + if [ "$1" = "-" ] + then + shift + suppress=":" + for i in ${1+"$@"} + do + case "$all " in + *\ $i\ *) + ;; + *) + usage + ;; + esac + suppress="$suppress$i:" + done + for i in $all + do + case "$suppress" in + *:$i:*) + ;; + *) + targets="$targets $i" + ;; + esac + done + else + for i in ${1+"$@"} + do + case "$all " in + *\ $i\ *) + ;; + *) + usage + ;; + esac + targets="$targets $i" + done + fi +fi + +[ "X$targets" = "X" ] && barf "no targets" + +version="`head -1 package/version`" +here="`pwd`" +command="`echo $here | sed -e 's/-'$version'$//'`/command" +package="`basename $here | sed -e 's/-'$version'$//'`" +shout "symlink $package -> $package-$version" +safe rm -f $package +safe ln -s $package-$version $package +safe mv -f $package .. + +commands="" +for i in $targets +do + commands="$commands `cat package/commands-$i`" +done + +if [ -r package/command-cp ] +then + for i in `sed -e '/^$/q' < package/command-cp` + do + shout "copying commands into $i" + safe mkdir -p $i + for j in $commands + do + j=${j%:} + safe rm -f $i/$j'{new}' + safe cp -p command/$j $i/$j'{new}' + safe mv -f $i/$j'{new}' $i/$j + done + done +fi + +if [ -r package/command-ln ] +then + for i in `sed -e '/^$/q' < package/command-ln` + do + safe mkdir -p $i + for j in $commands + do + k=${j%:} + [ "$j" = "$k:" ] && \ + shout "linking command $k into $i" && \ + safe rm -f $i/$k'{new}' && \ + safe ln -s $command/$k $i/$k'{new}' && \ + safe mv -f $i/$k'{new}' $i/$k + done + done +fi + +exit 0 -- cgit v1.2.3