12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #? stdtmpl(subsChar='?') | standard
- #proc generateDeinstallScript(c: ConfigData): string =
- # result = "#! /bin/sh\n# Generated by niminst\n"
- # var proj = c.name.toLowerAscii
- 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 similar '/opt')"
- exit 1
- ;;
- "/usr/bin")
- bindir=/usr/bin
- configdir=/etc/?proj
- libdir=/usr/lib/?proj
- docdir=/usr/share/?proj/doc
- datadir=/usr/share/?proj/data
- nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
- ;;
- "/usr/local/bin")
- bindir=/usr/local/bin
- configdir=/etc/?proj
- libdir=/usr/local/lib/?proj
- docdir=/usr/local/share/?proj/doc
- datadir=/usr/local/share/?proj/data
- nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
- ;;
- "/opt")
- bindir="/opt/?proj/bin"
- configdir="/opt/?proj/config"
- libdir="/opt/?proj/lib"
- docdir="/opt/?proj/doc"
- datadir="/opt/?proj/data"
- nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
- ;;
- *)
- bindir="$1/?proj/bin"
- configdir="$1/?proj/config"
- libdir="$1/?proj/lib"
- docdir="$1/?proj/doc"
- datadir="$1/?proj/data"
- nimbleDir="$1/?proj"
- ;;
- esac
- echo "removing files..."
- #for ff in items(c.cat[fcUnixBin]):
- #let f = ff.toUnix
- rm -f $bindir/?f.skipRoot
- #end for
- #for ff in items(c.cat[fcConfig]):
- #let f = ff.toUnix
- rm -f $configdir/?f.skipRoot
- #end for
- rm -rf $docdir
- rm -rf $datadir
- rm -rf $libdir
- ## Nimble pkg stuff
- #for f in items(c.cat[fcNimble]):
- rm -f $nimbleDir/?f.toUnix
- #end for
- rm -f $nimbleDir/?{c.nimblePkgName}.nimble
- 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 similar '/opt')"
- exit 1
- fi
|