mkgitrel.cln: run single check pass and refuse --force releases
[releases.git] / mkgitrel.rel
1 #! /bin/bash
2
3 # Copyright 2021-2023 Alexandre Oliva <lxoliva@fsfla.org>
4 #
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.
8 #
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.
13 #
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.
18 #
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
22 # USA
23
24 scriptdir=$(dirname "$0")
25 . $scriptdir/mkgitrel.gcfg
26
27 success=:
28 for rel
29 do
30     
31 . $scriptdir/mkgitrel.setprev &&
32
33 if test -f linux-libre-$rel.check; then
34     success=false
35     git worktree remove logs/v$rel
36     git worktree remove --force sources/v$rel
37     continue
38 fi &&
39
40 . $scriptdir/mkgitrel.setdate &&
41
42 plist="patch-$prev0-$rel" &&
43 if test "$prev0" != "$prevn"; then
44   plist="$plist patch-$prevn-$rel"
45 fi &&
46
47 list="linux-libre-$rel.tar $plist" &&
48
49 bzip2 -k9 $list &&
50 xz -k9 $list &&
51 lzip -k9s64MiB $list &&
52
53 mkdir -v $rel &&
54
55 for f in $(ls scripts/v$rel); do
56   if cmp scripts/v$rel/$f $reldir/$prevn/$f; then
57     gpg --verify $reldir/$prevn/$f.sign &&
58     ln -v $reldir/$prevn/$f $reldir/$prevn/$f.sign $rel/
59   else
60     ln -v scripts/v$rel/$f $rel/ &&
61     gpg --armor --detach-sign $rel/$f &&
62     mv -v $rel/$f.asc $rel/$f.sign
63   fi
64 done &&
65
66 ln -v logs/v$rel/linux-libre-$rel.* $rel/ &&
67
68 for f in $plist; do
69   gpg --armor --detach-sign $f &&
70   mv -v $f.asc $rel/$f.sign
71 done &&
72
73 for ext in .bz2 .xz .lz; do
74   for f in $list; do
75     mv -v $f$ext $rel/ &&
76     gpg --armor --detach-sign $rel/$f$ext &&
77     mv -v $rel/$f$ext.asc $rel/$f$ext.sign
78   done
79 done &&
80
81 rm -vf $list &&
82
83 mv -v $rel $reldir/$rel &&
84 ln -snfv $rel $reldir/LATEST-$cbr.N &&
85 if test "$rup" = "$cbr"; then
86   ln -nfv $reldir/LATEST-$cbr.N $reldir/LATEST-$cbr.0 &&
87   ln -nfv $reldir/LATEST-$cbr.N $reldir/LATEST-${cbr%.*}.N
88 elif test -n "$prevbase" && test ! -h $reldir/LATEST-$cbr.0; then
89   ln -nfv $reldir/LATEST-$prevbase.N $reldir/LATEST-$cbr.0
90 fi &&
91
92 git worktree remove logs/v$rel &&
93 git worktree remove scripts/v$rel &&
94
95 continue
96
97 success=false
98
99 done &&
100
101 $success