@@ -46,12 +46,12 @@ echo "Panel is now in maintenance mode."
46
46
db_connection=$( grep " ^DB_CONNECTION=" " $env_file " | cut -d ' =' -f 2)
47
47
48
48
if [ -z " $db_connection " ]; then
49
- echo " DB_CONNECTION not found in $env_file ."
50
- exitInstall 0
49
+ db_connection=' sqlite'
50
+ echo " DB_CONNECTION not found in $env_file , using $db_connection as default."
51
+ else
52
+ echo " DB_CONNECTION is set to: $db_connection "
51
53
fi
52
54
53
- echo " DB_CONNECTION is set to: $db_connection "
54
-
55
55
read -p " Do you want to create a backup? (y/n) [y]: " backup_confirm
56
56
backup_confirm=${backup_confirm:- y}
57
57
if [ " $backup_confirm " != " y" ]; then
@@ -69,24 +69,31 @@ if [ $? -ne 0 ]; then
69
69
fi
70
70
echo " Backed up .env file successfully."
71
71
72
- cp -a " $install_dir /storage/app/public" " $backup_dir /storage/app/"
73
- if [ $? -ne 0 ]; then
74
- echo " Failed to backup avatars & fonts files, aborting"
75
- exitInstall 1
72
+ if [ -d " $install_dir /storage/app/public" ]; then
73
+ cp -a " $install_dir /storage/app/public" " $backup_dir /storage/app/"
74
+ if [ $? -ne 0 ]; then
75
+ echo " Failed to backup avatars & fonts files, aborting"
76
+ exitInstall 1
77
+ fi
76
78
fi
77
79
78
80
if [ " $db_connection " = " sqlite" ]; then
79
81
db_database=$( grep " ^DB_DATABASE=" " $env_file " | cut -d ' =' -f 2)
80
82
81
83
if [ -z " $db_database " ]; then
82
- echo " DB_DATABASE not found in $env_file ."
83
- exitInstall 1
84
+ uses_default=true
85
+ db_database=' database.sqlite'
86
+ echo " DB_DATABASE not found in $env_file , using $db_database as default."
84
87
fi
85
88
86
89
if [[ " $db_database " != * .sqlite ]]; then
87
90
db_database=" $db_database .sqlite"
88
91
fi
89
- echo " DB_DATABASE is set to: $db_database "
92
+
93
+ if [ -z " $uses_default " ]; then
94
+ echo " DB_DATABASE is set to: $db_database "
95
+ fi
96
+
90
97
cp -a " $install_dir /database/$db_database " " $backup_dir /$db_database .backup"
91
98
if [ $? -ne 0 ]; then
92
99
echo " Failed to backup $db_database file, aborting"
@@ -161,14 +168,16 @@ if [ $? -ne 0 ]; then
161
168
exitInstall 1
162
169
fi
163
170
164
- echo " Restoring avatars & fonts"
165
- cp -a " $backup_dir /storage/app/public" " $install_dir /storage/app/"
166
- if [ $? -ne 0 ]; then
167
- echo " Failed to restore avatars & fonts files, aborting"
168
- exitInstall 1
171
+ if [ -d " $backup_dir /storage/app/public" ]; then
172
+ echo " Restoring avatars & fonts"
173
+ cp -a " $backup_dir /storage/app/public" " $install_dir /storage/app/"
174
+ if [ $? -ne 0 ]; then
175
+ echo " Failed to restore avatars & fonts files, aborting"
176
+ exitInstall 1
177
+ fi
169
178
fi
170
179
171
- if [ " $db_connection " = " sqlite " ]; then
180
+ if [ -f " $backup_dir / $db_database .backup " ]; then
172
181
echo " Restoring sqlite database"
173
182
cp -a " $backup_dir /$db_database .backup" " $install_dir /database/$db_database "
174
183
if [ $? -ne 0 ]; then
0 commit comments