summary refs log blame commit diff stats
path: root/tools/deinstall.tmpl
blob: 61141f78eee4a4a71cb35e6f965f95a9559aee73 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                   






                                                        
                                                 











































                                                     
                                             







                                                 
#! stdtmpl(subsChar='?') | standard
#proc GenerateDeinstallScript(c: TConfigData): string = 
#  result = "#! /bin/sh\n# Generated by niminst\n"
#  var proj = c.name.toLower

if [ $# -eq 1 ] ; then
  case $1 in
    "--help"|"-h"|"help"|"h")
      echo "?c.displayName deinstallation script"
      echo "Usage: [sudo] sh deinstall.sh DIR"
      echo "Where DIR may be:"
      echo "  /usr/bin"
      echo "  /usr/local/bin"
      echo "  /opt"
      echo "  <some other dir> (treated like '/opt')"
      exit 1
      ;;
    "/usr/bin")
      bindir=/usr/bin
      configdir=/etc
      libdir=/usr/lib/?proj
      docdir=/usr/share/?proj/doc
      datadir=/usr/share/?proj/data
      ;;
    "/usr/local/bin")
      bindir=/usr/local/bin
      configdir=/etc
      libdir=/usr/local/lib/?proj
      docdir=/usr/local/share/?proj/doc
      datadir=/usr/local/share/?proj/data
      ;;
    *)
      bindir="$1/?proj/bin"
      configdir="$1/?proj/config"
      libdir="$1/?proj/lib"
      docdir="$1/?proj/doc"
      datadir="$1/?proj/data"
      ;;
  esac
  echo "removing files..."

#for f in items(c.cat[fcUnixBin]):
  rm -f $bindir/?f.skipRoot
#end for
#for f in items(c.cat[fcConfig]): 
  rm -f $configdir/?f.skipRoot
#end for
  rm -rf $docdir
  rm -rf $datadir
  rm -rf $libdir

  echo "deinstallation successful"
else
  echo "?c.displayName deinstallation script"
  echo "Usage: [sudo] sh deinstall.sh DIR"
  echo "Where DIR may be:"
  echo "  /usr/bin"
  echo "  /usr/local/bin"
  echo "  /opt"
  echo "  <some other dir> (treated like '/opt')"
  exit 1
fi