2015-08-27 18:55:29 +00:00
|
|
|
function omf.remove_package
|
2015-08-29 22:24:51 +00:00
|
|
|
|
2015-08-26 15:20:13 +00:00
|
|
|
for pkg in $argv
|
2015-08-29 18:10:47 +00:00
|
|
|
set -l remove_status 1
|
|
|
|
|
2015-08-27 18:55:29 +00:00
|
|
|
if not omf.util_valid_package $pkg
|
2015-09-01 11:38:32 +00:00
|
|
|
if test $pkg = "omf" -o $pkg = "default"
|
|
|
|
echo (omf::err)"You can't remove `$pkg`"(omf::off) 1^&2
|
2015-08-26 15:20:13 +00:00
|
|
|
else
|
|
|
|
echo (omf::err)"$pkg is not a valid package/theme name"(omf::off) 1^&2
|
|
|
|
end
|
|
|
|
return $OMF_INVALID_ARG
|
|
|
|
end
|
|
|
|
|
2015-08-29 18:10:47 +00:00
|
|
|
for path in {$OMF_PATH,$OMF_CONFIG}/{pkg}/$pkg
|
|
|
|
not test -d $path; and continue
|
|
|
|
|
2015-08-26 15:20:13 +00:00
|
|
|
emit uninstall_$pkg
|
2015-09-07 22:34:11 +00:00
|
|
|
omf.bundle.remove "package" $pkg
|
2015-08-29 22:24:51 +00:00
|
|
|
|
2015-08-29 18:10:47 +00:00
|
|
|
rm -rf $path
|
|
|
|
set remove_status $status
|
|
|
|
end
|
|
|
|
|
|
|
|
for path in {$OMF_PATH,$OMF_CONFIG}/{themes}/$pkg
|
|
|
|
not test -d $path; and continue
|
|
|
|
|
2015-08-26 15:20:13 +00:00
|
|
|
if test $pkg = (cat $OMF_CONFIG/theme)
|
2015-09-01 11:38:32 +00:00
|
|
|
echo default > $OMF_CONFIG/theme
|
2015-08-26 15:20:13 +00:00
|
|
|
end
|
2015-08-29 18:10:47 +00:00
|
|
|
|
2015-09-07 22:34:11 +00:00
|
|
|
omf.bundle.remove "theme" $pkg
|
2015-08-29 22:24:51 +00:00
|
|
|
|
2015-08-29 18:10:47 +00:00
|
|
|
rm -rf $path
|
|
|
|
set remove_status $status
|
2015-08-26 15:20:13 +00:00
|
|
|
end
|
2015-08-29 18:10:47 +00:00
|
|
|
|
|
|
|
if test $remove_status -eq 0
|
2015-09-06 20:01:11 +00:00
|
|
|
echo (omf::em)"$pkg successfully removed."(omf::off)
|
2015-08-29 22:24:51 +00:00
|
|
|
refresh
|
2015-08-26 15:20:13 +00:00
|
|
|
else
|
|
|
|
echo (omf::err)"$pkg could not be found"(omf::off) 1^&2
|
|
|
|
end
|
|
|
|
end
|
2015-08-26 18:15:05 +00:00
|
|
|
end
|