-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrebuild.sh
More file actions
executable file
·31 lines (23 loc) · 1.03 KB
/
rebuild.sh
File metadata and controls
executable file
·31 lines (23 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# This script automates the cleaning, rebuilding, and reinstallation
# of the 'stickynotes' snap package.
# Exit immediately if a command exits with a non-zero status.
set -e
SNAP_NAME="stickynotes-dabobroto"
echo "--- Removing old version of $SNAP_NAME ---"
# Attempt to remove the snap. If it's not installed, this will fail.
# '|| true' ensures the script doesn't exit if the snap isn't found.
sudo snap remove $SNAP_NAME || true
echo "--- Cleaning the project with lxd ---"
# Clean the project directory. We use 'sudo' to handle any files
# created by a root process in previous builds.
snapcraft clean --use-lxd
echo "--- Packing the new snap ---"
# Create the new .snap package.
snapcraft --use-lxd
echo "--- Installing the new snap package ---"
# Find the most recently created .snap file to install it.
# This avoids hardcoding the version number.
SNAP_FILE=$(find . -name "*.snap" -printf "%T@ %p\n" | sort -n | tail -1 | cut -d' ' -f2-)
sudo snap install "$SNAP_FILE" --dangerous
echo "--- Rebuild and reinstall complete! ---"