Skip to content

Instantly share code, notes, and snippets.

@hansdg1
Last active January 22, 2017 00:13
Show Gist options
  • Save hansdg1/f2869b58fc667f5a876b85f146e5f688 to your computer and use it in GitHub Desktop.
Save hansdg1/f2869b58fc667f5a876b85f146e5f688 to your computer and use it in GitHub Desktop.
Automatically install packages after a firmware upgrade to the ERLite
#!/bin/bash
# Installed by: Hans Guthrie
# Date: 11/6/2016
# Install dir: /config/scripts/post-config.d/
# Notes: The purpose of this file is to automatically install packages after a firmware upgrade to the
# ERLite. After every upgrade, the /config directory is copied to the new image.
# Followed steps from here:
# https://help.ubnt.com/hc/en-us/articles/204961814-EdgeMAX-Are-my-changes-lost-when-I-upgrade-the-firmware-image-
#
# TODO: Add a -f/--force option to force install packages
# Packages to install
# EDIT THIS:
PACKAGES='screen rsync iftop iptraf mtr-tiny bmon htop git vim'
# Variable to ensure script doesn't run twice
doneit='/var/lib/my_packages'
if [ -e $doneit ]; then
echo "Packages already installed. If not, delete /var/lib/my_packages"
exit 0;
fi
apt-get update
apt-get install -y $PACKAGES
if [ $? == 0 ]; then
echo package install successful
touch $doneit
else
echo package install failed
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment