Created
October 4, 2021 09:00
-
-
Save paour/3fccdbd9daf6ea3cae15d4ae63c69155 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
source /etc/os-release | |
declare -A packages | |
declare -i installed=0 | |
packages[htop]=https://github.com/mback2k/torcx-htop/releases/download/3.0.3-1/torcx.tgz | |
packages[qemu-ga]=https://github.com/mback2k/torcx-qemu-ga/releases/download/5.0.2-2/torcx.tgz | |
packages[mosh-server]=https://github.com/paour/torcx-mosh-server/releases/download/v1.3.2/torcx.tgz | |
for KEY in "${!packages[@]}"; do | |
PKG="/var/lib/torcx/store/${VERSION_ID}/${KEY}:CoreOS_${VERSION_ID}.torcx.tgz" | |
BIN="/var/run/torcx/bin/$KEY" | |
if [ -f "${BIN}" ] | |
then | |
echo "Already installed ${KEY}, skipping" | |
continue | |
fi | |
installed+=1 | |
mkdir -p "/var/lib/torcx/store/${VERSION_ID}" | |
wget "${packages[$KEY]}" -O "${PKG}" | |
done | |
if [ $installed -ne 0 ] ; then | |
for KEY in "${!packages[@]}"; do | |
images="{ \"name\": \"${KEY}\", \"reference\": \"CoreOS_${VERSION_ID}\" },${images}" | |
done | |
jq ".value.images += [${images::-1}]" /usr/share/torcx/profiles/vendor.json > /etc/torcx/profiles/local.json | |
echo local > /etc/torcx/next-profile | |
echo "Rebooting" | |
# reboot | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment