deinstall.nimf 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #? stdtmpl(subsChar='?') | standard
  2. #proc generateDeinstallScript(c: ConfigData): string =
  3. # result = "#! /bin/sh\n# Generated by niminst\n"
  4. # var proj = c.name.toLowerAscii
  5. if [ $# -eq 1 ] ; then
  6. case $1 in
  7. "--help"|"-h"|"help"|"h")
  8. echo "?c.displayName deinstallation script"
  9. echo "Usage: [sudo] sh deinstall.sh DIR"
  10. echo "Where DIR may be:"
  11. echo " /usr/bin"
  12. echo " /usr/local/bin"
  13. echo " /opt"
  14. echo " <some other dir> (treated similar '/opt')"
  15. exit 1
  16. ;;
  17. "/usr/bin")
  18. bindir=/usr/bin
  19. configdir=/etc/?proj
  20. libdir=/usr/lib/?proj
  21. docdir=/usr/share/?proj/doc
  22. datadir=/usr/share/?proj/data
  23. nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
  24. ;;
  25. "/usr/local/bin")
  26. bindir=/usr/local/bin
  27. configdir=/etc/?proj
  28. libdir=/usr/local/lib/?proj
  29. docdir=/usr/local/share/?proj/doc
  30. datadir=/usr/local/share/?proj/data
  31. nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
  32. ;;
  33. "/opt")
  34. bindir="/opt/?proj/bin"
  35. configdir="/opt/?proj/config"
  36. libdir="/opt/?proj/lib"
  37. docdir="/opt/?proj/doc"
  38. datadir="/opt/?proj/data"
  39. nimbleDir="/opt/nimble/pkgs/?c.nimblePkgName-?c.version"
  40. ;;
  41. *)
  42. bindir="$1/?proj/bin"
  43. configdir="$1/?proj/config"
  44. libdir="$1/?proj/lib"
  45. docdir="$1/?proj/doc"
  46. datadir="$1/?proj/data"
  47. nimbleDir="$1/?proj"
  48. ;;
  49. esac
  50. echo "removing files..."
  51. #for ff in items(c.cat[fcUnixBin]):
  52. #let f = ff.toUnix
  53. rm -f $bindir/?f.skipRoot
  54. #end for
  55. #for ff in items(c.cat[fcConfig]):
  56. #let f = ff.toUnix
  57. rm -f $configdir/?f.skipRoot
  58. #end for
  59. rm -rf $docdir
  60. rm -rf $datadir
  61. rm -rf $libdir
  62. ## Nimble pkg stuff
  63. #for f in items(c.cat[fcNimble]):
  64. rm -f $nimbleDir/?f.toUnix
  65. #end for
  66. rm -f $nimbleDir/?{c.nimblePkgName}.nimble
  67. echo "deinstallation successful"
  68. else
  69. echo "?c.displayName deinstallation script"
  70. echo "Usage: [sudo] sh deinstall.sh DIR"
  71. echo "Where DIR may be:"
  72. echo " /usr/bin"
  73. echo " /usr/local/bin"
  74. echo " /opt"
  75. echo " <some other dir> (treated similar '/opt')"
  76. exit 1
  77. fi