diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-21 16:08:30 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-21 16:08:30 -0800 |
| commit | a9f8d2d8ac4093d04daf98c36804a1edd20c9af4 (patch) | |
| tree | 5ed595d5374d04eb8cd91c7084d9a66772ec8930 /lib/tools/uninstall.nom | |
| parent | 894ef41ac23f448b8539338eaec7bb1f06f2d9bb (diff) | |
Added install/uninstall tools
Diffstat (limited to 'lib/tools/uninstall.nom')
| -rwxr-xr-x | lib/tools/uninstall.nom | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/tools/uninstall.nom b/lib/tools/uninstall.nom new file mode 100755 index 0000000..881705a --- /dev/null +++ b/lib/tools/uninstall.nom @@ -0,0 +1,38 @@ +# + A tool to uninstall third party Nomsu packages (the inverse of the install tool) + + Usage: + nomsu -t uninstall <package_names...> + +use "filesystem" +use "commandline" +use "shell" + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +(run command $cmd) means: + say $cmd + try: + sh> $cmd + ..if it fails: + say (" + Sorry, the uninstall failed. You may need to re-run as root with `sudo` in front of the command. + ") + exit 1 + +command line program with $args: + $(NOMSU PACKAGEPATH) or= "/opt/nomsu" + $searchpath = + [ + : for $ in ["?.lua", "?/init.lua", "?.nom", "?/init.nom"]: + add "\$(NOMSU PACKAGEPATH)\$" + ], joined with ";" + + for $package_name in $args.extras: + $path = ($package.searchpath $package_name $package.nomsupath "/") + unless $path: + say "Sorry, couldn't find \$package_name in \$(NOMSU PACKAGEPATH)" + exit 1 + $path = ($path, with "/init%.nom" -> "") + unless ((ask "Do you want to delete \$path? [Y/n] ") == "n"): + run command "rm -rv \$path" |
