#! /bin/sh #---------------------------------------------------------------------------- # deinstall-package - deinstall packages # # Creation: 09.12.2001 ms # Last Update: $Id$ # # Copyright (c) 2001-2005 Michell Schimanski # Frank Meyer # # 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. #---------------------------------------------------------------------------- # include eislib . /var/install/include/eislib read_package_info () { file=$1 package='' description='' version='' date='' author='' while read line do case "$line" in ""* | ""*) set -- $line package="$2" [ "$package" = '' ] && package=`echo "$line" | sed 's###g'` ;; ""*) set -- $line shift [ "$description" = '' ] && description="$*" ;; ""*) description=`echo "$line" | sed 's###g'` ;; ""*) set -- $line version="$2" [ "$version" = '' ] && version=`echo "$line" | sed 's###g'` ;; ""*) set -- $line date="$2" [ "$date" = '' ] && date=`echo "$line" | sed 's###g'` ;; ""*) set -- $line author="$*" author=`echo "$author" | sed 's###g' | sed 's###g'` ;; *) ;; esac done < $file } normalize_version () { v=$1 case $v in 1.0beta) v=0.90.0 ;; 1.0beta-patch-*) IFS='-' set -- $v unset IFS v=0.90.$3 ;; esac case "$v" in [0-9]*.[0-9]*.[0-9]*) IFS='.' set -- $v unset IFS major=$1 minor=$2 revision=$3 ;; [0-9]*.[0-9]*) IFS='.' set -- $v unset IFS major=$1 minor=$2 revision=0 ;; *) major=0 minor=0 revision=0 ;; esac version=$major.$minor.$revision } while [ 1 ] do clrhome mecho -info "Remove packages" mecho techo begin 4 4 31 28 12 row=3 a='' n=0 for j in /var/install/packages/* do n=`expr $n + 1` read_package_info $j normalize_version $version techo row "" "$n." "$package" "$version" "$date" eval package_$n='"$j"' row=`expr $row + 1` if [ $row = 21 ] then mecho mecho a=`/var/install/bin/ask "Select package to remove" "" "1-$n" "^$=Continue" "0=Return"` if [ "$a" = "0" ] then techo end exit 0 fi if [ "$a" != "" ] then break fi clrhome mecho -info "Remove package" mecho row=3 fi done techo end if [ "$a" = "" ] then mecho mecho a=`/var/install/bin/ask "Select package to remove" "" "1-$n" "^$=Return" "0=Exit"` fi if [ "$a" = "0" ] then exit 127 fi if [ "$a" = "" ] then exit 0 fi eval file='$package_'$a read_package_info $file normalize_version $version clrhome mecho -info "Package information" mecho mecho " Package: $package" mecho mecho " Description: $description" mecho mecho " Version: $version" mecho mecho " Date: $date" mecho mecho " Author: $author" mecho mecho if /var/install/bin/ask "Remove package" then /var/install/bin/del-package $package fi anykey done