-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupgrade.sh
More file actions
executable file
·95 lines (81 loc) · 1.37 KB
/
upgrade.sh
File metadata and controls
executable file
·95 lines (81 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
#
# Upgrade script for OnMyShelf docker
#
#
# Functions
#
# Print usage
print_help() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -v, --version VERSION Choose a version to install"
echo " -b, --backup Force backup before upgrade"
echo " --no-backup Do not backup before upgrade"
echo " -h, --help Print this help"
}
#
# Main program
#
# go into current directory
cd "$(dirname "$0")" || exit
# load functions
source .functions.sh || exit
# get options
force_mode=false
while [ $# -gt 0 ] ; do
case $1 in
-b|--backup)
backup=true
;;
-v|--version)
if [ -z "$2" ] ; then
print_help
exit 1
fi
version=$2
shift
;;
--no-backup)
backup=false
;;
-y|--yes)
force_mode=true
;;
-h|--help)
print_help
exit 0
;;
-*)
echo "Unknown option: $1"
print_help
exit 1
;;
esac
shift
done
pull_project
check_env
if [ -z "$backup" ] ; then
if $force_mode ; then
backup=true
else
echo "Do you want to backup your instance before upgrade?"
if lb_yesno -y "It is highly recommended." ; then
backup=true
fi
echo
fi
fi
# backup instance
if [ "$backup" = true ] ; then
echo "Run backup script:"
docker compose exec server oms-backup || exit 1
echo
fi
if ! $force_mode ; then
lb_yesno -y "Proceed to upgrade?" || exit 0
echo
fi
change_version
start_server