Skip to content

Instantly share code, notes, and snippets.

@sandalsoft
Last active May 28, 2021 03:41
Show Gist options
  • Save sandalsoft/91f4d8a72186c9424b1862a89ba9f7fc to your computer and use it in GitHub Desktop.
Save sandalsoft/91f4d8a72186c9424b1862a89ba9f7fc to your computer and use it in GitHub Desktop.
downloads rpi bash customization files from gist and creates local files
#!/usr/bin/bash
set -e
echo ""
echo ""
echo "Setting bash shell customizations for Raspian or Ubuntu-server based Pi's"
echo "LET'S GO NOW!!"
function file.fetch () {
SOURCE=$1
DEST=$2
# echo "source: $SOURCE"
# echo "dest: $DEST"
if [[ -s $2 ]]; then
echo ""
echo "🚨🚨 $2 exists and is not empty 🚨🚨"
echo ""
else
echo ""
echo "🛰 Creating new $2 from gist..."
/usr/bin/curl -s "$1" > $2
echo "☑️ Done."
echo ""
fi
}
SOURCES_URL='https://gist.githubusercontent.com/sandalsoft/25c21ee34a67a9096f8ebb8a9ee2d437/raw/adaa74ed8271b37642328a85d26ab6dd8e02c36f/pi.bash_sources'
SOURCES_FILE='.bash_sources'
BASHRC_URL='https://gist.githubusercontent.com/sandalsoft/a1bd0ec84300b8f5c7ddff38784eef17/raw/ce882b3f2b3b5437248d0b7f87833aab3c9c6632/pi.bashrc'
BASHRC_FILE='.bashrc'
EXPORTS_URL='https://gist.githubusercontent.com/sandalsoft/4b69f8cca0715b6d4d81663c04263f46/raw/720fbd59274f2aff7e91195ef17aa3d60b1813e4/pi.bash_exports'
EXPORTS_FILE='.bash_exports'
FUNCTIONS_URL='https://gist.githubusercontent.com/sandalsoft/e98217a84d76e5ba798ff759d5471d38/raw/9d16a5095fa6ea2ae601e1552f3c9f8aef10434f/pi.bash_functions'
FUNCTIONS_FILE='.bash_functions'
ALIASES_URL='https://gist.githubusercontent.com/sandalsoft/24ef4188354b179e2515a9da824f57c4/raw/70895000162b6f66118bc7c7fb33b9afc3f79592/pi.bash_aliases'
ALIASES_FILE='.bash_aliases'
file.fetch $SOURCES_URL $SOURCES_FILE
file.fetch $BASHRC_URL $BASHRC_FILE
file.fetch $EXPORTS_URL $EXPORTS_FILE
file.fetch $FUNCTIONS_URL $FUNCTIONS_FILE
file.fetch $ALIASES_URL $ALIASES_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment