3 # Copyright 2021-2022 Alexandre Oliva <lxoliva@fsfla.org>
5 # This program is part of GNU Linux-libre, a GNU project that
6 # publishes scripts to clean up Linux so as to make it suitable for
7 # use in the GNU Project and in Free System Distributions.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
24 if test -d $reldir/$rel; then
25 echo $reldir/$rel exists >&2
29 rup=$(echo "$rel" | sed 's,-gnu[0-9]*$,,')
30 cbr=$(echo "$rup" | sed 's,\(\.\|-rc\)[0-9]*$,,')
32 if test -h $reldir/LATEST-$cbr.0; then
33 prev0=$(readlink $reldir/LATEST-$cbr.0)
34 prevn=$(readlink $reldir/LATEST-$cbr.N)
35 elif test -h $reldir/LATEST-$rup.N; then
37 prev0=$(readlink $reldir/LATEST-$cbr.0)
38 prevn=$(readlink $reldir/LATEST-$cbr.N)
41 [3-9].0-rc* | [1-9][0-9].0-rc*)
42 prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,')
43 if test -h $reldir/LATEST-$prevbase.N; then
44 prev0=$(readlink $reldir/LATEST-$prevbase.N)
46 elif pbase=$(expr "$prevbase" - 1) && test -h $reldir/LATEST-$pbase.N; then
48 prev0=$(readlink $reldir/LATEST-$prevbase.N)
51 echo neither $reldir/LATEST-$prevbase.N nor $reldir/LATEST-$pbase.N exist>&2
56 prevbase=$(echo "$cbr" | sed 's,\.[0-9]*$,,')
57 if test -h $reldir/LATEST-$prevbase.N; then
58 prev0=$(readlink $reldir/LATEST-$prevbase.N)
61 echo $reldir/LATEST-$prevbase.N does not exit >&2
66 echo Neither $reldir/LATEST-$cbr.0 nor $reldir/LATEST-$rup.N exist >&2