Skip to content

Commit b4005b4

Browse files
committed
Fix fresh install and upgrade scripts
1 parent 00cec8a commit b4005b4

File tree

8 files changed

+32
-22
lines changed

8 files changed

+32
-22
lines changed

Taskfile.yml

Lines changed: 2 additions & 2 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:
@@ -213,7 +213,7 @@ tasks:
213213
TMPDIR: '{{trimSuffix "/" (env "TMPDIR")| default "/tmp"}}/generate-assets'
214214
SEMVER_TAG: "{{.RUNNER_VERSION}}"
215215
OUTPUT_DIR: "{{.TMPDIR}}/{{.SEMVER_TAG}}"
216-
ASSETS_DIR: debian/arduino-app-cli/home/arduino/.local/share/arduino-app-cli/assets
216+
ASSETS_DIR: debian/arduino-app-cli/var/lib/arduino-app-cli/assets
217217
TESTDATA_DIR: internal/e2e/daemon/testdata/assets
218218
preconditions:
219219
- sh: '[ ! -d "{{.ASSETS_DIR}}/{{.SEMVER_TAG}}" ] || [ ! -d "{{.TESTDATA_DIR}}/{{.SEMVER_TAG}}" ]'

debian/arduino-app-cli/DEBIAN/postinst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ systemctl enable arduino-app-cli
66
systemctl enable arduino-burn-bootloader
77
systemctl enable arduino-avahi-serial.service
88

9-
echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX postinst $1 $2"
9+
delete_obsolete_files() {
10+
OBSOLETE_DIR="/home/arduino/.local/share/arduino-app-cli/examples"
11+
for i in "${OBSOLETE_DIR}"/*; do
12+
rm -rf "${i}"/.cache;
13+
done
14+
}
1015

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)
1316
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
17+
# if $2 is not empty, this is an upgrade
18+
if [ -n "$2" ]; then
19+
# check if this is an upgrade from an old version
20+
if dpkg --compare-versions "$2" lt "0.8.0"; then
21+
echo "Running pre-0.7.0 legacy cleanup/migration..."
22+
delete_obsolete_files
2123
fi
22-
fi
24+
fi
25+
fi

debian/arduino-app-cli/DEBIAN/postrm

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

43
set -e
54

debian/arduino-app-cli/DEBIAN/preinst

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

43
set -e
54

debian/arduino-app-cli/DEBIAN/prerm

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

43
systemctl disable arduino-app-cli
54
systemctl disable arduino-burn-bootloader
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Copyright 2025 ARDUINO SA (http://www.arduino.cc/)
2+
3+
This software is released under the GNU General Public License version 3,
4+
which covers the main part of arduino-app-cli.
5+
The terms of this license can be found at:
6+
https://www.gnu.org/licenses/gpl-3.0.en.html
7+
8+
You can be released from the requirements of the above licenses by purchasing
9+
a commercial license. Buying such a license is mandatory if you want to
10+
modify or otherwise use the software for commercial activities involving the
11+
Arduino software without disclosing the source code of your own applications.
12+
To purchase a commercial license, send an email to [email protected].
13+
14+
---
15+

docs/contributor-guide/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Build the project (run once):
2929

3030
Start the arduino-app-cli in daemon mode:
3131

32-
- `ARDUINO_APP_CLI__DATA_DIR=debian/arduino-app-cli/home/arduino/.local/share/arduino-app-cli go tool task start`
32+
- `ARDUINO_APP_CLI__DATA_DIR=debian/arduino-app-cli/var/lib/arduino-app-cli go tool task start`
3333

3434
NOTE: only a subset of HTTP APIs are working by running the daemon mode on a development PC. To run Arduino App CLI on the board see the **Running Arduino App CLI on the board** section below.
3535

internal/orchestrator/provision.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,6 @@ func generateMainComposeFile(
307307
Source: app.FullPath.String(),
308308
Target: "/app",
309309
},
310-
{
311-
Type: "bind",
312-
Source: app.ProvisioningStateDir().String(),
313-
Target: "/app/.cache",
314-
},
315310
}
316311
slog.Debug("Adding UNIX socket", slog.Any("sock", cfg.RouterSocketPath().String()), slog.Bool("exists", cfg.RouterSocketPath().Exist()))
317312
if cfg.RouterSocketPath().Exist() {

0 commit comments

Comments
 (0)