Merge lp:~verterok/ols-jenkaas/snap-sideload-classic-snaps into lp:~ols-jenkaas-admins/ols-jenkaas/trunk

Proposed by Guillermo Gonzalez
Status: Merged
Merged at revision: 702
Proposed branch: lp:~verterok/ols-jenkaas/snap-sideload-classic-snaps
Merge into: lp:~ols-jenkaas-admins/ols-jenkaas/trunk
Diff against target: 41 lines (+19/-10)
1 file modified
scripts/snap-sideload.sh (+19/-10)
To merge this branch: bzr merge lp:~verterok/ols-jenkaas/snap-sideload-classic-snaps
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+383211@code.launchpad.net

Commit message

Use 2 lists for classic and regular snaps in scripts/snap-sideload.sh

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

Good solution, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/snap-sideload.sh'
2--- scripts/snap-sideload.sh 2020-04-29 20:18:38 +0000
3+++ scripts/snap-sideload.sh 2020-04-30 11:48:22 +0000
4@@ -21,18 +21,27 @@
5
6 SWIFT_URL="{sideload.snaps.url}"
7 SNAPS_TO_INSTALL="{sideload.snaps}"
8-for snap_file in $SNAPS_TO_INSTALL
9-do
10+CLASSIC_SNAPS_TO_INSTALL="{sideload.classic_snaps}"
11+
12+fetch_snap () {
13+ snap_file=$1
14 echo "Downloading $snap_file (assert and snap)"
15 curl -s -o $TMP_DIR/$snap_file.assert $SWIFT_URL/$snap_file.assert
16 curl -s -o $TMP_DIR/$snap_file.snap $SWIFT_URL/$snap_file.snap
17+}
18+install_snap () {
19+ snap_file=$1
20+ classic=$2
21 sudo snap ack $TMP_DIR/$snap_file.assert
22- # FIXME: find a nice way to mark which snaps require classic instead of
23- # hardoding the check here
24- case $snap_file in
25- "charm"* | "codetree"*)
26- sudo snap install $TMP_DIR/$snap_file.snap --classic ;;
27- *)
28- sudo snap install $TMP_DIR/$snap_file.snap ;;
29- esac
30+ sudo snap install $TMP_DIR/$snap_file.snap $classic
31+}
32+for snap_file in $SNAPS_TO_INSTALL
33+do
34+ fetch_snap $snap_file
35+ install_snap $snap_file ""
36+done
37+for snap_file in $CLASSIC_SNAPS_TO_INSTALL
38+do
39+ fetch_snap $snap_file
40+ install_snap $snap_file "--classic"
41 done

Subscribers

People subscribed via source and target branches