Skip to content

Commit 00cec8a

Browse files
committed
Properly handle old and new files to be delete.
1 parent 059657c commit 00cec8a

File tree

452 files changed

+45
-5449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

452 files changed

+45
-5449
lines changed

Taskfile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ vars:
1010
DPRINT_VERSION: 0.48.0
1111
EXAMPLE_VERSION: "0.5.1"
1212
RUNNER_VERSION: "0.5.0"
13-
VERSION: # if version is not passed we hack the semver by encoding the commit as pre-release
13+
VERSION: #if version is not passed we hack the semver by encoding the commit as pre-release
1414
sh: echo "${VERSION:-0.0.0-$(git rev-parse --short HEAD)}"
1515

1616
tasks:
@@ -118,7 +118,7 @@ tasks:
118118
set -e
119119
echo "Runner version set as: {{ .EXAMPLE_VERSION }}"
120120
TMP_PATH="$(mktemp -d)"
121-
DEST_PATH="debian/arduino-app-cli/usr/share/arduino-app-cli/"
121+
DEST_PATH="debian/arduino-app-cli/var/lib/arduino-app-cli/"
122122
echo "Cloning arduino/app-bricks-examples into temporary directory ${TMP_PATH}..."
123123
git clone --depth 1 --branch "{{ .EXAMPLE_VERSION }}" https://github.com/arduino/app-bricks-examples "${TMP_PATH}"
124124
rm -rf "${DEST_PATH}/examples"
@@ -165,7 +165,7 @@ tasks:
165165
cmds:
166166
- docker build -t adbd -f adbd.Dockerfile .
167167
- docker rm -f adbd || true
168-
- docker run --rm --name adbd -d -p 5555:5555 -p 2222:22 -v $HOME/.arduino-app-cli/examples:/apps adbd
168+
- docker run --rm --name adbd -d -p 5555:5555 -p 2222:22 -v /var/lib/arduino-app-cli/examples:/apps adbd
169169

170170
adbd:stop:
171171
desc: stop adbd
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
#!/bin/sh
22

3-
mkdir /var/cache/arduino-app-cli
4-
chown -R arduino:arduino /var/cache/arduino-app-cli
5-
mkdir /home/arduino/.arduino-app-cli
6-
chown -R arduino:arduino /home/arduino/.arduino-app-cli
3+
set -e
74

85
systemctl enable arduino-app-cli
96
systemctl enable arduino-burn-bootloader
107
systemctl enable arduino-avahi-serial.service
8+
9+
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX postinst $1 $2"
10+
11+
# The following case will be executed for an upgrade from
12+
# any version before 0.7.0 (the last version with examples and assets in the home dir)
13+
if [ "$1" = "configure" ]; then
14+
if dpkg --compare-versions "$2" lt "0.7.0"; then
15+
echo "Detected upgrade from an older version, delete obsolete examples and assets."
16+
OBSOLETE_DIR="home/arduino/.local/share/arduino-app-cli"
17+
for i in ${OBSOLETE_DIR}/*; do
18+
CACHE_DIR=${OBSOLETE_DIR}/.cache
19+
[ -d "CACHE_DIR" ] && rm -r ${CACHE_DIR};
20+
done
21+
fi
22+
fi
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
#!/bin/sh
2+
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX postrm $1 $2"
23

3-
rm -rf /var/cache/arduino-app-cli/*
4+
set -e
45

56
if [ -d /run/systemd/system ]; then
67
systemctl daemon-reload
78
fi
9+
10+
EXAMPLES_DIR="/var/lib/arduino-app-cli"
11+
for i in ${EXAMPLES_DIR}/*; do
12+
CACHE_DIR=${EXAMPLES_DIR}/.cache
13+
[ -d "CACHE_DIR" ] && rm -r ${CACHE_DIR};
14+
done
15+
16+
if [ "$1" = "purge" ]; then
17+
CONF_DIR="/home/arduino/.config/arduino-app-cli"
18+
echo "Purging configuration directory: $CONF_DIR"
19+
[ -d "$CONF_DIR" ] && rm -rf "$CONF_DIR"
20+
fi
21+

debian/arduino-app-cli/DEBIAN/preinst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/sh
2+
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX preinst $1 $2"
23

34
set -e
45

@@ -23,3 +24,6 @@ if ! getent group "$SYSUPGRADE_GROUP" >/dev/null 2>&1; then
2324
groupadd --system "$SYSUPGRADE_GROUP"
2425
fi
2526
usermod -aG "$SYSUPGRADE_GROUP" "$APP_USER"
27+
28+
mkdir -p /home/arduino/.config/arduino-app-cli
29+
chown -R arduino:arduino /home/arduino/.config/arduino-app-cli
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
#!/bin/sh
2+
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX prerm $1 $2"
23

34
systemctl disable arduino-app-cli
45
systemctl disable arduino-burn-bootloader
56
systemctl disable arduino-avahi-serial.service
6-
7-
OLD_EXAMPLES_DIR="/home/arduino/.local/share/arduino-app-cli/examples"
8-
9-
if [ -d "OLD_EXAMPLES_DIR" ]; then
10-
for i in /home/arduino/.local/share/arduino-app-cli/examples/*; do
11-
rm -r $i/.cache;
12-
done
13-
fi

debian/arduino-app-cli/usr/share/arduino-app-cli/assets/0.5.0/api-docs/arduino/app_bricks/air_quality_monitoring/API.md

Lines changed: 0 additions & 192 deletions
This file was deleted.

debian/arduino-app-cli/usr/share/arduino-app-cli/assets/0.5.0/api-docs/arduino/app_bricks/arduino_cloud/API.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)