summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-04-06 07:19:08 -0300
committerRenato Botelho <renato@netgate.com>2016-04-06 07:19:08 -0300
commit5caee0ba0f8782ea7bf1df54ad0848da1d5084d2 (patch)
tree35cb7e63c5cc5c41fb2e89e4d962f3bd20db577a /src
parentf5edca6c481c72c063c7390afdececd54da10a6e (diff)
downloadpfsense-5caee0ba0f8782ea7bf1df54ad0848da1d5084d2.zip
pfsense-5caee0ba0f8782ea7bf1df54ad0848da1d5084d2.tar.gz
Do all steps to replace repo package and make sure symlink is in place
Diffstat (limited to 'src')
-rwxr-xr-xsrc/usr/local/sbin/pfSense-upgrade51
1 files changed, 29 insertions, 22 deletions
diff --git a/src/usr/local/sbin/pfSense-upgrade b/src/usr/local/sbin/pfSense-upgrade
index 0f486d4..42704f7 100755
--- a/src/usr/local/sbin/pfSense-upgrade
+++ b/src/usr/local/sbin/pfSense-upgrade
@@ -299,6 +299,9 @@ pkg_upgrade() {
_exec "pkg ${pkg_chroot} set -A 1 ${product}-repo-devel" \
"Scheduling package ${product}-repo-devel for removal"
_exec "pkg install ${_repo_pkg}" "Installing ${_repo_pkg}" mute
+ _exec "pkg delete ${product}-repo-devel" "Removing ${product}-repo-devel" \
+ mute ignore_result
+ validate_repo_conf
pkg_update force
fi
@@ -698,6 +701,31 @@ do_reboot() {
fi
}
+validate_repo_conf() {
+ # Make sure to use default repo conf when it doesn't exist
+ pkg_repo_conf="/usr/local/etc/pkg/repos/${product}.conf"
+ default_pkg_repo_conf_path="/usr/local/share/${product}/pkg/repos/${product}-repo.conf"
+
+ pkg_repo_conf_path=$(/usr/local/sbin/read_xml_tag.sh string system/pkg_repo_conf_path \
+ ${default_pkg_repo_conf_path})
+
+ if [ -z "${pkg_repo_conf_path}" -o ! -f "${pkg_repo_conf_path}" ]; then
+ pkg_repo_conf_path=${default_pkg_repo_conf_path}
+ fi
+
+ if [ -f "${pkg_repo_conf_path}" ]; then
+ if [ -e "${pkg_repo_conf}" -a ! -L "${pkg_repo_conf}" ]; then
+ rm -f ${pkg_repo_conf}
+ ln -sf ${pkg_repo_conf_path} ${pkg_repo_conf}
+ fi
+
+ if [ "$(readlink ${pkg_repo_conf})" != "${pkg_repo_conf_path}" ]; then
+ mkdir -p /usr/local/etc/pkg/repos
+ ln -sf ${pkg_repo_conf_path} ${pkg_repo_conf}
+ fi
+ fi
+}
+
export LANG=C
pid_file="/var/run/$(basename $0).pid"
@@ -726,28 +754,7 @@ else
export HTTP_USER_AGENT="${product}/${product_version}"
fi
-# Make sure to use default repo conf when it doesn't exist
-pkg_repo_conf="/usr/local/etc/pkg/repos/${product}.conf"
-default_pkg_repo_conf_path="/usr/local/share/${product}/pkg/repos/${product}-repo.conf"
-
-pkg_repo_conf_path=$(/usr/local/sbin/read_xml_tag.sh string system/pkg_repo_conf_path \
- ${default_pkg_repo_conf_path})
-
-if [ -z "${pkg_repo_conf_path}" -o ! -f "${pkg_repo_conf_path}" ]; then
- pkg_repo_conf_path=${default_pkg_repo_conf_path}
-fi
-
-if [ -f "${pkg_repo_conf_path}" ]; then
- if [ -e "${pkg_repo_conf}" -a ! -L "${pkg_repo_conf}" ]; then
- rm -f ${pkg_repo_conf}
- ln -sf ${pkg_repo_conf_path} ${pkg_repo_conf}
- fi
-
- if [ "$(readlink ${pkg_repo_conf})" != "${pkg_repo_conf_path}" ]; then
- mkdir -p /usr/local/etc/pkg/repos
- ln -sf ${pkg_repo_conf_path} ${pkg_repo_conf}
- fi
-fi
+validate_repo_conf
# Flags used in _exit
export delete_annotation=""
OpenPOWER on IntegriCloud