Skip to content

Commit 5657c6b

Browse files
committed
Address review.
1 parent c90eaec commit 5657c6b

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

debian/arduino-app-cli/DEBIAN/helper_func.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ cleanup_arduino_examples() {
1313
local EXAMPLES=$(find "${EXAMPLES_DIR}" -maxdepth 1 -mindepth 1 -type d 2>/dev/null)
1414
echo "Stopping apps and clearing cache in: ${EXAMPLES_DIR}"
1515
for dir_path in ${EXAMPLES}; do
16-
echo " -> Stopping app/removing cache in: ${dir_path}"
17-
1816
# 1. Stop the application (suppress output and errors)
1917
sudo -u arduino /usr/bin/arduino-app-cli app stop "${dir_path}" > /dev/null 2>&1 || true
2018

debian/arduino-app-cli/DEBIAN/postinst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ chown -R arduino:arduino /var/lib/arduino-app-cli
55
systemctl enable arduino-app-cli
66
systemctl enable arduino-burn-bootloader
77
systemctl enable arduino-avahi-serial.service
8+
9+
if [ "$1" = "configure" ]; then
10+
if dpkg --compare-versions "$2" lt "0.9.0"; then
11+
echo "Running pre-0.9.0 legacy migration..."
12+
rm -rf /home/arduino/.local/share/arduino-app-cli/examples
13+
fi
14+
fi

debian/arduino-app-cli/DEBIAN/preinst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ usermod -aG "$SYSUPGRADE_GROUP" "$APP_USER"
2828
# SHARED_FUNCTIONS
2929

3030
if [ "$1" = "upgrade" ]; then
31-
# if $2 is not empty, this is an upgrade
32-
if [ -n "$2" ]; then
33-
# check if this is an upgrade from an old version
34-
if dpkg --compare-versions "$2" lt "0.9.0"; then
35-
echo "Running pre-0.9.0 legacy cleanup/migration..."
36-
cleanup_arduino_examples /home/arduino/.local/share/arduino-app-cli/examples
37-
fi
31+
# check if this is an upgrade from an old version
32+
if dpkg --compare-versions "$2" lt "0.9.0"; then
33+
echo "Running pre-0.9.0 legacy migration..."
34+
cleanup_arduino_examples /home/arduino/.local/share/arduino-app-cli/examples
35+
mkdir -p /var/lib/arduino-app-cli
36+
cp -rf /home/arduino/.local/share/arduino-app-cli/examples /var/lib/arduino-app-cli
3837
fi
3938
fi
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/bin/sh
22

33
set -e
4+
45
systemctl disable arduino-app-cli
56
systemctl disable arduino-burn-bootloader
67
systemctl disable arduino-avahi-serial.service
78

89
# SHARED_FUNCTIONS
910

10-
echo "Running pre-0.8.0 legacy cleanup/migration..."
11-
cleanup_arduino_examples /home/arduino/.local/share/arduino-app-cli/examples
1211
echo "Cache cleanup..."
1312
cleanup_arduino_examples /var/lib/arduino-app-cli/examples

0 commit comments

Comments
 (0)