Project

General

Profile

« Previous | Next » 

Revision 23ee0868

Added by Renato Botelho almost 10 years ago

Relocate main block and leave all functions in the beggining

View differences:

src/usr/local/sbin/pfSense-upgrade
46 46
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 47
# OF THE POSSIBILITY OF SUCH DAMAGE.
48 48

  
49
pid_file="/var/run/$(basename $0).pid"
50
last_update_file="/var/run/$(basename $0)-last-update"
51
logfile=/cf/conf/upgrade_log.txt
52

  
53
# pkg should not ask for confirmations
54
export ASSUME_ALWAYS_YES=true
55

  
56
# Disable automatic update
57
export REPO_AUTOUPDATE=false
58

  
59
# File used to detect second call, after kernel update and reboot
60
upgrade_in_progress="/cf/conf/upgrade_in_progress"
61

  
62
stdout='/dev/null'
63
unset yes
64
action="run_upgrade"
65
while getopts duy opt; do
66
	case ${opt} in
67
		d)
68
			stdout=''
69
			;;
70
		u)
71
			action="run_update"
72
			;;
73
		y)
74
			yes=1
75
			;;
76
		*)
77
			usage
78
			exit 1
79
			;;
80
	esac
81
done
82

  
83 49
usage() {
84 50
	_echo "Usage: $(basename ${0}) [-duy]"
85 51
	_echo "	-d - Turn on debug"
......
300 266
	fi
301 267
}
302 268

  
269
pid_file="/var/run/$(basename $0).pid"
270
last_update_file="/var/run/$(basename $0)-last-update"
271
logfile=/cf/conf/upgrade_log.txt
272

  
273
# pkg should not ask for confirmations
274
export ASSUME_ALWAYS_YES=true
275

  
276
# Disable automatic update
277
export REPO_AUTOUPDATE=false
278

  
279
# File used to detect second call, after kernel update and reboot
280
upgrade_in_progress="/cf/conf/upgrade_in_progress"
281

  
282
stdout='/dev/null'
283

  
284
unset yes
285
action="run_upgrade"
286
while getopts duy opt; do
287
	case ${opt} in
288
		d)
289
			stdout=''
290
			;;
291
		u)
292
			action="run_update"
293
			;;
294
		y)
295
			yes=1
296
			;;
297
		*)
298
			usage
299
			exit 1
300
			;;
301
	esac
302
done
303

  
303 304
if pgrep -qF ${pid_file} >/dev/null 2>&1; then
304 305
	echo "Another instance is already running... Aborting!"
305 306
	exit 1

Also available in: Unified diff