#!/bin/sh # restore binary-all links # Copyright (C) 2000 James Troup # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # WARNING: this is a quick hack to fix several architectures in sid; # it has lots of things hardcoded when they shouldn't be etc. ####################################################################### source `dirname $0`/vars # defaults dry_run=no ####################################################################### count=0 # Write usage message usage() { echo "usage: $progname [-n] architecture" 1>&2 } # Write error message to stderr and quit. error() { echo "$progname: $@" 1>&2 exit 1 } # Check for at least one argument if [ $# -eq 0 ]; then usage exit 1 fi # Parse options progname="$0" loop=yes while [ $loop = yes ] do case "$1" in -n|--dry-run) dry_run="yes"; shift 1;; --) shift; loop=no ;; -h|--help) usage; exit 0 ;; -*) error "unknown option $1" ;; *) loop=no ;; esac done cd $ftp/dists/potato/ if [ ! -d main/binary-$1 ]; then echo "Can't find arch $1" exit 1 fi echo "About to run this horrible script for arch $1 which will probably break things." echo -n "Are you sure? [Y/n]: " read answer if [ -z "$answer" ]; then answer="y"; fi case "$answer" in n|N) echo "Aborting..";exit 0;; y|Y) ;; *) echo "E: '$answer' not understood, exiting.";rm .genreport; exit 1;; esac for j in main non-free contrib; do for i in $(find $j/binary-all/ ! -type d); do dir=$(dirname $i | sed -e "s/binary-all/binary-$1/") pushd $dir >/dev/null if [ ! -e $(basename $i) ]; then if [ "$dry_run" = "no" ]; then echo "Linking to $i" ln -s ../../../$i . else echo "Would link to $i" fi count=$(expr $count + 1) fi popd > /dev/null done done echo "Added $count links."