Debian Codegraph @

install/unix/delete

raw symbols SCIP
1 #! /bin/sh
2 # .COPYRIGHT: Copyright (c) 1988 European Southern Observatory,
3 # all rights reserved
4 # .TYPE command
5 # .NAME delete.sh
6 # .LANGUAGE shell script
7 # .ENVIRONMENT Unix Systems. Executable under SHELL and C-SHELL
8 # .COMMENTS
9 #
10 # .AUTHOR Carlos Guirao
11 # .VERSION 1.1 30-Oct-1989: Implementation.
12 # .VERSION 1.2 05-Dec-1989: Adding "echo" definition
13 # 070615 last modif
14 #
15 echo=echo
16 if [ "`echo -n`" = "-n" ] ; then
17 SV_NONL="\c"
18 else
19 echo="echo -n"
20 fi
21
22 #
23 # First of all, goto the config directory MID_INSTALL
24 # <dirname> & <basename> commands emulated with <sed>
25 # cd `dirname $0`
26 # MIDVERS=`basename $VERSDIR`
27 # MIDASHOME=`dirname $VERSDIR`
28 #
29 if [ -z "$MIDASHOME" -o -z "$MIDVERS" ] ; then
30 cd `echo $0 | sed -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
31 MID_INSTALL=`pwd`
32 VERSDIR=`echo $MID_INSTALL | sed 's/\/install\/unix$//'`
33 MIDVERS=`echo $VERSDIR | sed -e 's/^.*\///'`
34 MIDASHOME=`echo $VERSDIR | sed -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
35 else
36 cd $MIDASHOME/$MIDVERS/install/unix
37 fi
38
39 MID_INSTALL=$MIDASHOME/$MIDVERS/install/unix
40 MID_HOME=$MIDASHOME/$MIDVERS
41
42 #
43 # START
44 #
45
46 # Check weather "ls -s" command returns blocks of 1/2 or 1 kbytes.
47 # The file test_file_1k is 1kbyte big.
48 factor_ls=`ls -s test_file_1k | awk '{print $1}'`
49
50 while : ; do
51 (echo ""
52 echo " DELETE EXECUTABLES FILES FROM:"
53 echo ""
54 echo " NAME CATEGORY"
55 echo " ========================"
56 for categ in applic stdred contrib gui
57 do
58 if [ ! -d $MID_HOME/$categ ]; then
59 continue
60 fi
61 cd $MID_HOME/$categ
62 for pack in `ls | grep -E -v 'lib|exec|proc'`
63 do
64 if [ -f $pack/src/makefile ] ; then
65 echo " $pack $categ "
66 fi
67 done
68 done
69 echo "" ) | more
70 cd $MID_INSTALL
71 echo "Type <Q> to quit or <L> to list again."
72
73 while : ; do
74 $echo "Select NAME to DELETE: " $SV_NONL
75 read name
76 if [ "$name" = "q" -o "$name" = "Q" ] ; then
77 exit
78 fi
79 if [ "$name" = "l" -o "$name" = "L" ] ; then
80 break
81 fi
82 if [ "$name" = "" ] ; then
83 continue
84 fi
85 if [ -f $MID_HOME/applic/$name/src/makefile ] ; then
86 categ=applic
87 elif [ -f $MID_HOME/stdred/$name/src/makefile ] ; then
88 categ=stdred
89 elif [ -f $MID_HOME/contrib/$name/src/makefile ] ; then
90 categ=contrib
91 elif [ -f $MID_HOME/gui/$name/src/makefile ] ; then
92 categ=gui
93 else
94 echo "$name: No such package with that name"
95 continue
96 fi
97
98 $echo "Number of kbytes to be deleted: (wait) " $SV_NONL
99 cd $MID_HOME/$categ/$name/src
100 ls -s `make -n clean_exec | sed -e 's/^rm//' -e 's/-f//'` 2>/dev/null | \
101 awk -f $MID_INSTALL/size.awk factor=$factor_ls
102 if [ $? != 0 ] ; then
103 continue
104 fi
105 $echo "Do you want to delete $name executables [yn]? (y): " $SV_NONL
106 read answ
107 if [ -z "$answ" ]; then
108 answ=y
109 fi
110 if [ "$answ" != "y" -a "$answ" != "Y" ]; then
111 cd $MID_INSTALL
112 echo ""
113 continue
114 fi
115
116 make clean_exec
117 cd $MID_INSTALL
118 echo ""
119 done
120 done
121
122 exit