summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2013-07-05 21:40:31 +0000
committerdteske <dteske@FreeBSD.org>2013-07-05 21:40:31 +0000
commit34bf19a5d0ac489c070e03f8ba4c6e323d942e39 (patch)
treee78603bbc65ec7799912c998bd6db0b651f5af05 /usr.sbin
parentffe2fc46c58979addcc7b675ecafad49153e8d3e (diff)
downloadFreeBSD-src-34bf19a5d0ac489c070e03f8ba4c6e323d942e39.zip
FreeBSD-src-34bf19a5d0ac489c070e03f8ba4c6e323d942e39.tar.gz
Add the necessary code to reinstall packages. Both scripted access
(packageReinstall) and UI access have been tested successfully with a variation of different situations including: + Reinstall a package for which no other packages depend + Purposefully do thinks like reinstall a package that is not installed + Try to reinstall a package which other installed packages still depend NOTE: There is no "force" used; if a package is required by other packages, it will not be uninstalled (and therefore no reinstall is done).
Diffstat (limited to 'usr.sbin')
-rwxr-xr-xusr.sbin/bsdconfig/share/packages/packages.subr11
-rw-r--r--usr.sbin/bsdconfig/share/script.subr1
2 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/bsdconfig/share/packages/packages.subr b/usr.sbin/bsdconfig/share/packages/packages.subr
index 6441c4f..3f5d3d8 100755
--- a/usr.sbin/bsdconfig/share/packages/packages.subr
+++ b/usr.sbin/bsdconfig/share/packages/packages.subr
@@ -648,7 +648,7 @@ f_package_review()
debug= f_getvar _mark_$varpkg mark
[ "$mark" = "R" ] || continue
f_dprintf "%s: Reinstalling %s package" $fname "$package"
- # XXX Re-install package
+ f_package_reinstall "$package"
done
for package in $SELECTED_PACKAGES; do
mark=
@@ -1186,6 +1186,15 @@ f_package_delete()
fi
}
+# f_package_reinstall $name
+#
+# A simple wrapper to f_package_delete() + f_package_add()
+#
+f_package_reinstall()
+{
+ f_package_delete "$1" && f_package_add "$1"
+}
+
############################################################ MAIN
f_dprintf "%s: Successfully loaded." packages/packages.subr
diff --git a/usr.sbin/bsdconfig/share/script.subr b/usr.sbin/bsdconfig/share/script.subr
index 72ff8f3..5dc39e6 100644
--- a/usr.sbin/bsdconfig/share/script.subr
+++ b/usr.sbin/bsdconfig/share/script.subr
@@ -196,6 +196,7 @@ f_resword_new configPCNFSD f_config_pcnfsd
f_resword_new configPackages f_package_config
f_resword_new packageAdd f_package_add
f_resword_new packageDelete f_package_delete
+f_resword_new packageReinstall f_package_reinstall
# variable.subr
f_resword_new installVarDefaults f_variable_set_defaults
OpenPOWER on IntegriCloud