summaryrefslogtreecommitdiffstats
path: root/src/usr/local/share/pfSense
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-09-16 12:07:26 -0300
committerRenato Botelho <renato@netgate.com>2016-09-16 12:07:26 -0300
commit678004ceda0a34ca196f2920c763b55a37cb0208 (patch)
tree0d54ff1a1280aefa3eac3dcc4a8ab45a0b14ef96 /src/usr/local/share/pfSense
parent3cd56f54453b4673ea52875a129a1f9a79909bb6 (diff)
downloadpfsense-678004ceda0a34ca196f2920c763b55a37cb0208.zip
pfsense-678004ceda0a34ca196f2920c763b55a37cb0208.tar.gz
Remove pre/post upgrade scripts
Thise scripts were used on tarball upgrade before pkg(8). Users running pfSense < 2.3 will need to go to 2.3 first and then to 2.4 so they will not be necessary anymore
Diffstat (limited to 'src/usr/local/share/pfSense')
-rwxr-xr-xsrc/usr/local/share/pfSense/post_upgrade_command74
-rwxr-xr-xsrc/usr/local/share/pfSense/post_upgrade_command.php50
-rw-r--r--src/usr/local/share/pfSense/pre_upgrade_command159
3 files changed, 0 insertions, 283 deletions
diff --git a/src/usr/local/share/pfSense/post_upgrade_command b/src/usr/local/share/pfSense/post_upgrade_command
deleted file mode 100755
index f51edec..0000000
--- a/src/usr/local/share/pfSense/post_upgrade_command
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/sh
-#
-# post_upgrade_command
-#
-# part of pfSense (https://www.pfsense.org)
-# Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
-# All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-/etc/rc.conf_mount_rw
-
-PFSENSETYPE=`cat /etc/platform`
-
-if [ "${PFSENSETYPE}" = "pfSense" -o "${PFSENSETYPE}" = "nanobsd" ]; then
- touch /conf/needs_package_sync_after_reboot
-fi
-
-if [ "${PFSENSETYPE}" = "nanobsd" ]; then
- ROOT=/tmp/${1}/
-else
- ROOT=/
-fi
-
-# Now turn on or off serial console as needed
-echo "Checking for ${ROOT}usr/local/share/pfSense/post_upgrade_command.php... " >> /conf/upgrade_log.txt
-if [ -x ${ROOT}usr/local/share/pfSense/post_upgrade_command.php ]; then
- echo "Running ${ROOT}usr/local/share/pfSense/post_upgrade_command.php $1" >> /conf/upgrade_log.txt
- ${ROOT}usr/local/share/pfSense/post_upgrade_command.php $1 >> /conf/upgrade_log.txt 2>&1
-fi
-
-# Fixup permissions on installed files
-if [ -f ${ROOT}usr/local/share/pfSense/base.mtree ]; then
- if [ -x "/tmp/mtree.old" ]; then
- MTREE_BIN=/tmp/mtree.old
- else
- MTREE_BIN=/usr/sbin/mtree
- fi
- ${MTREE_BIN} -U -e -q -f ${ROOT}usr/local/share/pfSense/base.mtree -p ${ROOT} > /conf/mtree.log
-fi
-
-# Make sure to preserve existing time zone
-if [ "${PFSENSETYPE}" = "nanobsd" -a -f /etc/localtime ]; then
- /bin/cp -p /etc/localtime ${ROOT}etc/localtime 2>/dev/null
-fi
-
-# Files may contain spaces
-oIFS=${IFS}
-IFS="
-"
-# Obsolete files - nanobsd doesn't need it since a new image is installed
-# on the other partition
-if [ "${PFSENSETYPE}" != "nanobsd" -a -f /etc/pfSense.obsoletedfiles ]; then
- for f in $(cat /etc/pfSense.obsoletedfiles); do
- if [ -n "${f}" -a -f "${f}" ]; then
- rm -f "${f}"
- elif [ -n "${f}" -a -d "${f}" ]; then
- rm -rf "${f}"
- fi
- done
-fi
-
-# Restore IFS
-IFS=${oIFS}
diff --git a/src/usr/local/share/pfSense/post_upgrade_command.php b/src/usr/local/share/pfSense/post_upgrade_command.php
deleted file mode 100755
index 16333db..0000000
--- a/src/usr/local/share/pfSense/post_upgrade_command.php
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/local/bin/php -f
-<?php
-/*
- * post_upgrade_command.php
- *
- * part of pfSense (https://www.pfsense.org)
- * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
- * All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- /* upgrade embedded users serial console */
- require_once("globals.inc");
- require_once("config.inc");
- require_once("functions.inc");
-
- if (file_exists("/usr/local/bin/git") && isset($config['system']['gitsync']['synconupgrade'])) {
- if (!empty($config['system']['gitsync']['repositoryurl'])) {
- exec("cd /root/pfsense/pfSenseGITREPO/pfSenseGITREPO && git config remote.origin.url " . escapeshellarg($config['system']['gitsync']['repositoryurl']));
- }
- if (!empty($config['system']['gitsync']['branch'])) {
- system("pfSsh.php playback gitsync " . escapeshellarg($config['system']['gitsync']['branch']) . " --upgrading");
- }
- }
-
- $newslicedir = "";
- if (isset($argv[1]) && $argv[1] != "") {
- $newslicedir = '/tmp/' . $argv[1];
- }
-
- if ($g['enableserial_force'] || file_exists("{$newslicedir}/enableserial_force")) {
- $config['system']['enableserial'] = true;
- write_config();
- }
-
- system("echo \"Adding serial port settings ({$newslicedir})...\" >> /conf/upgrade_log.txt");
- setup_serial_port("upgrade", $newslicedir);
-
-?>
diff --git a/src/usr/local/share/pfSense/pre_upgrade_command b/src/usr/local/share/pfSense/pre_upgrade_command
deleted file mode 100644
index ae1c41e..0000000
--- a/src/usr/local/share/pfSense/pre_upgrade_command
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/bin/sh
-#
-# pre_upgrade_command
-#
-# part of pfSense (https://www.pfsense.org)
-# Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
-# All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-/etc/rc.conf_mount_rw
-
-# Record the previous version
-PRIOR_VERSION=`uname -r | cut -d'.' -f1`
-echo $PRIOR_VERSION > /tmp/pre_upgrade_version
-
-# De-activate sync on root filesystem. See ticket #4523
-# Back up original fstab
-/bin/cp /etc/fstab /etc/fstab.orig
-# De-activate sync on the root slice only. This will not match NanoBSD since it already has sync,noatime
-/usr/bin/sed -i '' 's/^\(\/.*[[:space:]]*\/[[:space:]]*ufs[[:space:]]*\)rw,sync\([[:space:]]*[[:digit:]][[:space:]]*[[:digit:]]\)$/\1rw\2/' /etc/fstab
-
-# Uninstall all packages before upgrade to 2.3
-PFSENSE_VERSION=$(cat /etc/version)
-
-if echo "$PFSENSE_VERSION" | grep -q '^1.2'; then
- UNINSTALL="uninstall_package_from_name"
-else
- UNINSTALL="uninstall_package"
-fi
-
-cat >/tmp/remove_all_packages.php <<EOD
-#!/usr/local/bin/php
-<?php
-
-require_once("pkg-utils.inc");
-
-global \$pkg_interface;
-\$pkg_interface = "console";
-
-if (!isset(\$config['installedpackages']['package'])) {
- exit(0);
-}
-
-if (!is_array(\$config['installedpackages']['package'])) {
- exit(0);
-}
-
-\$removed_packages = array();
-foreach (\$config['installedpackages']['package'] as \$package) {
- if (isset(\$package['internal_name'])) {
- \$removed_packages[] = \$package['internal_name'];
- } else {
- \$rename_arr = array("Quagga OSPF" => "Quagga_OSPF", "System Patches" => "System_Patches");
- if (key_exists(\$package['name'], \$rename_arr)) {
- \$removed_packages[] = \$rename_arr[\$package['name']];
- } else {
- \$removed_packages[] = \$package['name'];
- }
- }
- ${UNINSTALL}(\$package['name']);
-}
-
-@file_put_contents("{\$g['cf_conf_path']}/packages_to_reinstall_after_upgrade.txt", implode("\\n",\$removed_packages));
-
-?>
-EOD
-
-/usr/local/bin/php /tmp/remove_all_packages.php
-rm -f /tmp/remove_all_packages.php
-
-# Cleanup PBIs
-if which pbi_info >/dev/null 2>&1; then
- for pbi in $(pbi_info); do
- echo ">>> Removing PBI ${pbi} and all symlinks"
- pbi_prefix=$(pbi_info ${pbi} | awk '$1 == "Prefix:" { print $2 }')
-
- for subdir in bin sbin; do
- if [ ! -d "${pbi_prefix}/${subdir}" ]; then
- continue
- fi
-
- for pbiopt in ${pbi_prefix}/${subdir}/*.pbiopt; do
- link_name=$(awk '$1 == "TARGET:" { print $2 }' ${pbiopt})
-
- if [ -z "${link_name}" ]; then
- continue
- fi
-
- if [ -L /usr/local/${link_name} ]; then
- rm -f /usr/local/${link_name}
- fi
- done
- done
-
- pbi_delete ${pbi}
- done
-
- # Cleanup remaining symbolic links
- find / -type l -lname '/usr/pbi/*' -delete
-fi
-
-# Hack to workaround ticket #3749
-if [ ${PRIOR_VERSION} -le 8 ] && grep -q 'sh /etc/rc.reboot' /etc/rc.firmware; then
- PROC=$(ps axwww | grep '/etc/rc.firmware *pfSenseupgrade')
- PID=''
- IMG=''
- if [ -n "${PROC}" ]; then
- PID=$(echo "${PROC}" | awk '{print $1}')
- IMG=$(echo "${PROC}" | sed 's,^.*pfSenseupgrade *,,')
- fi
-
- if [ -n "${PID}" -a -n "${IMG}" -a -f "${IMG}" ]; then
- cp -fp /bin/sh /tmp/sh.old
- kill ${PID} >/dev/null 2>&1
- kill -9 ${PID} >/dev/null 2>&1
- sed -i '' -e 's,sh /,/tmp/sh.old /,' \
- -e 's,/usr/sbin/mtree,/tmp/mtree.old,' /etc/rc.firmware
- # To avoid restarting rc.firmware twice because of #4328
- sed -i '' -e '/^restore_chflags()/, /^}/ s/mtree *-PU/mtree -P/' /etc/rc.firmware
- /etc/rc.firmware pfSenseupgrade "${IMG}"
- exit
- fi
-fi
-
-# One more hack to workaround #4328
-if grep -q 'mtree *-PU' /etc/rc.firmware; then
- PROC=$(ps axwww | grep '/etc/rc.firmware *pfSenseupgrade')
- PID=''
- IMG=''
- if [ -n "${PROC}" ]; then
- PID=$(echo "${PROC}" | awk '{print $1}')
- IMG=$(echo "${PROC}" | sed 's,^.*pfSenseupgrade *,,')
- fi
-
- if [ -n "${PID}" -a -n "${IMG}" -a -f "${IMG}" ]; then
- kill ${PID} >/dev/null 2>&1
- kill -9 ${PID} >/dev/null 2>&1
- sed -i '' -e '/^restore_chflags()/, /^}/ s/mtree *-PU/mtree -P/' /etc/rc.firmware
- /etc/rc.firmware pfSenseupgrade "${IMG}"
- exit
- fi
-fi
-
-# Make sure /boot files are not protected with schg
-chflags -R noschg /boot >/dev/null 2>&1
-
-rm /boot/kernel/*
-
OpenPOWER on IntegriCloud