@@ -156,12 +156,14 @@ check_apt_dependencies() {
156
156
# Backup older installations (if any) but keep the froster-archive.json and config.ini files
157
157
backup_old_installation () {
158
158
159
- echo
160
- echo " Backing up older froster installation (if any)..."
161
-
162
159
# Back up (if any) older froster data files
163
160
if [[ -d ${XDG_DATA_HOME} /froster ]]; then
164
161
162
+ backup=true
163
+
164
+ echo
165
+ echo " Backing up older froster installation..."
166
+
165
167
# Copy the froster directory to froster_YYYYMMDD.bak
166
168
cp -rf ${XDG_DATA_HOME} /froster ${XDG_DATA_HOME} /froster_${date_YYYYMMDDHHMMSS} .bak
167
169
@@ -171,27 +173,29 @@ backup_old_installation() {
171
173
# Back up (if any) older froster configurations
172
174
if [[ -d ${XDG_CONFIG_HOME} /froster ]]; then
173
175
176
+ if [ " $backup " != " true" ]; then
177
+ echo
178
+ echo " Backing up older froster installation..."
179
+ fi
180
+
181
+ backup=true
182
+
174
183
# Move the froster config directory to froster.bak
175
184
cp -rf ${XDG_CONFIG_HOME} /froster ${XDG_CONFIG_HOME} /froster_${date_YYYYMMDDHHMMSS} .bak
176
185
177
186
echo " Config back up at ${XDG_CONFIG_HOME} /froster_${date_YYYYMMDDHHMMSS} .bak"
178
187
fi
179
188
180
- echo " ...older froster installation backed up"
189
+ if [ " $backup " = " true" ]; then
190
+ echo " ...older froster installation backed up"
191
+ fi
181
192
182
193
# Check if froster is already installed, if so uninstall it
183
194
if which froster > /dev/null 2>&1 ; then
184
195
echo
185
196
echo " Uninstalling existing froster installation..."
186
197
187
- if pip list | grep froster > /dev/null 2>&1 ; then
188
- pip uninstall froster > /dev/null 2>&1 &
189
- spinner $!
190
- fi
191
-
192
198
if pipx list | grep froster > /dev/null 2>&1 ; then
193
- # If froster is installed with pipx, uninstall it and ignore errors
194
- # sometime pipx uninstall fails with error code 1 if PIPX_HOME is set, but froster is still uninstalled
195
199
pipx uninstall froster > /dev/null 2>&1 &
196
200
spinner $!
197
201
fi
@@ -201,11 +205,16 @@ backup_old_installation() {
201
205
202
206
# Keep the froster-archives.json file (if any)
203
207
if [[ -f ${XDG_DATA_HOME} /froster_${date_YYYYMMDDHHMMSS} .bak/froster-archives.json ]]; then
208
+ echo
209
+ echo " Restoring Froster archives json data from backup..."
210
+
204
211
# Create the froster directory if it does not exist
205
212
mkdir -p ${XDG_DATA_HOME} /froster
206
213
207
214
# Copy the froster-archives.json file to the data directory
208
215
cp -f ${XDG_DATA_HOME} /froster_${date_YYYYMMDDHHMMSS} .bak/froster-archives.json ${XDG_DATA_HOME} /froster/froster-archives.json
216
+
217
+ echo " ...restored"
209
218
fi
210
219
211
220
# Remove old files
@@ -226,7 +235,7 @@ install_froster() {
226
235
227
236
if [ " $LOCAL_INSTALL " = " true" ]; then
228
237
echo " Installing from the current directory"
229
- pip install . > /dev/null 2>&1 &
238
+ pipx install . > /dev/null 2>&1 &
230
239
spinner $!
231
240
else
232
241
echo " Installing from PyPi package repository"
0 commit comments