f37 -> f39
[infrastructure.git] / scripts / sfa-stable-debian.sh
1 #!/bin/bash
2 # usage e.g. $0 1.0-20
3 [[ -z "$@" ]] && { echo Usage $0 stable ; exit 1 ; }
4 stable=$1; shift
5 [[ -n "$@" ]] && { echo Usage $0 stable ; exit 1 ; }
6 stable=$(echo $stable | sed -e s,/,,g)
7 stabledot=$(echo $stable | sed -e s,-,.,g)
8 for dir in $(ls -d $stable/*[24]) ; do
9   base=$(echo $dir | sed -e s,$stable,,g -e s,$stabledot,,g -e s,/sfa--,,g)
10   version=$(echo $dir | cut -c1)
11   stablelink="stable-sfa$version-$base"
12   echo Linking $stablelink to $dir
13   [ -h $stablelink ] && rm $stablelink
14   [ -e $stablelink ] && { echo "found not-a-link $base - ignored" ; continue  ; }
15   ln -s $dir $stablelink
16 done