]> git.decadent.org.uk Git - dak.git/blob - contrib/fix.3
Initial revision
[dak.git] / contrib / fix.3
1 #!/bin/sh
2
3 # restore binary-all links
4 # Copyright (C) 2000 James Troup <james@nocrew.org>
5
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation; either version 2 of the
9 # License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 # WARNING: this is a quick hack to fix several architectures in sid;
21 #          it has lots of things hardcoded when they shouldn't be etc.
22
23 #######################################################################
24 source `dirname $0`/vars
25
26 # defaults
27
28 dry_run=no
29
30 #######################################################################
31
32 count=0 
33
34 # Write usage message
35 usage() {
36         echo "usage: $progname [-n] architecture" 1>&2
37 }
38
39 # Write error message to stderr and quit.
40 error() {
41         echo "$progname: $@" 1>&2
42         exit 1
43 }
44
45 # Check for at least one argument
46 if [ $# -eq 0 ]; then 
47   usage
48   exit 1
49 fi
50
51 # Parse options
52 progname="$0"
53 loop=yes
54 while [ $loop = yes ]
55 do
56         case "$1" in
57         -n|--dry-run) dry_run="yes"; shift 1;;
58         --)             shift; loop=no ;;
59         -h|--help)      usage; exit 0 ;;
60         -*)             error "unknown option $1" ;;
61         *)              loop=no ;;
62         esac
63 done
64
65 cd $ftp/dists/potato/
66
67 if [ ! -d main/binary-$1 ]; then
68     echo "Can't find arch $1"
69     exit 1
70 fi
71
72 echo "About to run this horrible script for arch $1 which will probably break things."
73 echo -n "Are you sure? [Y/n]: "
74 read answer
75 if [ -z "$answer" ]; then answer="y"; fi
76 case "$answer" in
77   n|N) echo "Aborting..";exit 0;;
78   y|Y) ;;
79   *)   echo "E: '$answer' not understood, exiting.";rm .genreport; exit 1;;
80 esac
81
82 for j in main non-free contrib; do
83     for i in $(find $j/binary-all/ ! -type d); do 
84         dir=$(dirname $i | sed -e "s/binary-all/binary-$1/")
85         pushd $dir >/dev/null
86         if [ ! -e $(basename $i) ]; then
87             if [ "$dry_run" = "no" ]; then
88                 echo "Linking to $i"
89                 ln -s ../../../$i .
90             else
91                 echo "Would link to $i"
92             fi
93             count=$(expr $count + 1)
94         fi
95         popd > /dev/null
96     done
97 done
98
99 echo "Added $count links."