#!/bin/sh -e # this script will look for upgrade scripts in # /usr/share/alternc/install/upgrades and execute them based on the # extension # # usage: # $0 oldvers, where oldvers is the version of the package previously # installed # # an upgrade file is considered only if its basename is a version # number greater than the $oldvers argument # remove version from filename by stripping the extension strip_ext() { echo $1 | sed -e 's/\.[^.]*$//' -e 's/[a-z_]*$//' } # find the version from a filename by stripping everything but the extension get_ext() { echo $1 | sed 's/^.*\.\([^.]*\)$/\1/' } oldvers=$1 if [ -z "$oldvers" -o "$oldvers" = '' ]; then # this is not an upgrade exit 0 fi #Checking the form of the version variable. it should be x.x.x with x as a digit. #If it is not we correct it. if echo $oldvers | grep -qi '[0-9]\.[0-9]\.[0-9].*' ; then echo upgrading from : $oldvers else old_ifs="$IFS" IFS='~' read PART1 PART2 <