summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-09-25 09:25:46 -0300
committerRenato Botelho <renato@netgate.com>2015-09-25 09:25:46 -0300
commit23ee0868b4c6f759ab98d25fe637149e7ff7256a (patch)
tree92c0ce670c81a2340844e6cf195725f0ce179d86 /src
parentb046b5c42ded3d8fff3cf567b743fd6530ff8453 (diff)
downloadpfsense-23ee0868b4c6f759ab98d25fe637149e7ff7256a.zip
pfsense-23ee0868b4c6f759ab98d25fe637149e7ff7256a.tar.gz
Relocate main block and leave all functions in the beggining
Diffstat (limited to 'src')
-rwxr-xr-xsrc/usr/local/sbin/pfSense-upgrade69
1 files changed, 35 insertions, 34 deletions
diff --git a/src/usr/local/sbin/pfSense-upgrade b/src/usr/local/sbin/pfSense-upgrade
index 41fddcf..f979c63 100755
--- a/src/usr/local/sbin/pfSense-upgrade
+++ b/src/usr/local/sbin/pfSense-upgrade
@@ -46,40 +46,6 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.
-pid_file="/var/run/$(basename $0).pid"
-last_update_file="/var/run/$(basename $0)-last-update"
-logfile=/cf/conf/upgrade_log.txt
-
-# pkg should not ask for confirmations
-export ASSUME_ALWAYS_YES=true
-
-# Disable automatic update
-export REPO_AUTOUPDATE=false
-
-# File used to detect second call, after kernel update and reboot
-upgrade_in_progress="/cf/conf/upgrade_in_progress"
-
-stdout='/dev/null'
-unset yes
-action="run_upgrade"
-while getopts duy opt; do
- case ${opt} in
- d)
- stdout=''
- ;;
- u)
- action="run_update"
- ;;
- y)
- yes=1
- ;;
- *)
- usage
- exit 1
- ;;
- esac
-done
-
usage() {
_echo "Usage: $(basename ${0}) [-duy]"
_echo " -d - Turn on debug"
@@ -300,6 +266,41 @@ upgrade() {
fi
}
+pid_file="/var/run/$(basename $0).pid"
+last_update_file="/var/run/$(basename $0)-last-update"
+logfile=/cf/conf/upgrade_log.txt
+
+# pkg should not ask for confirmations
+export ASSUME_ALWAYS_YES=true
+
+# Disable automatic update
+export REPO_AUTOUPDATE=false
+
+# File used to detect second call, after kernel update and reboot
+upgrade_in_progress="/cf/conf/upgrade_in_progress"
+
+stdout='/dev/null'
+
+unset yes
+action="run_upgrade"
+while getopts duy opt; do
+ case ${opt} in
+ d)
+ stdout=''
+ ;;
+ u)
+ action="run_update"
+ ;;
+ y)
+ yes=1
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
if pgrep -qF ${pid_file} >/dev/null 2>&1; then
echo "Another instance is already running... Aborting!"
exit 1
OpenPOWER on IntegriCloud