Skip to content

Instantly share code, notes, and snippets.

@taikedz
Last active August 23, 2018 11:24
Show Gist options
  • Save taikedz/88953a6adf480477225ff101eb9b7c80 to your computer and use it in GitHub Desktop.
Save taikedz/88953a6adf480477225ff101eb9b7c80 to your computer and use it in GitHub Desktop.
Initial setup script
# You can copy/paste this to a terminal
# No stdin swallowing issues, no working dir displacement
install-my-tools() {
# Try to run something, offer the user a way to resolve problems and retry
try-to() {
local result
echo -e "\033[31;1m$*\033[0m"
while ! (set -e; "$@"); do
espeak 'Error" executing command' # the " is audible punctuation
read -p "Retry? (Ctrl-C to abort script) y/N > " result
if [[ ! "$result" =~ ^(y|Y|yes|YES)$ ]]; then
return 1
fi
done
}
add-ppas() {
local ppa
for ppa in "$@"; do
try-to sudo add-apt-repository -y "$ppa"
done
sudo apt update
}
clone-install() {
local repo="$(basename "$1")"
git clone "$1"
if [[ -f "$repo/install.sh" ]]; then
${2:-} "$repo/install.sh"
elif [[ -d "$repo/bin" ]]; then
cp "$repo/bin/*" "$HOME/.local/bin/"
else
echo -e "\033[31;1m-- nothing to install from $repo --\033[0m"
return 1
fi
}
sudo apt update && try-to sudo apt install -y git espeak htop tmux
try-to mkdir -p "$HOME/github/taikedz"
try-to mkdir -p "$HOME/.local/bin"
cd "$HOME/github/taikedz"
try-to clone-install https://github.com/taikedz/alpacka sudo
try-to clone-install https://github.com/taikedz/git-shortcuts
try-to clone-install https://github.com/taikedz/bash-builder
( cd bash-builder/examples/ssh-connection-manager ; bbuild ; cp bin/connect ~/.local/bin/ )
try-to git clone https://github.com/taikedz/handy-scripts
try-to cp handy-scripts/config/vimrc "$HOME/.vimrc"
try-to git clone https://github.com/taikedz/docker-defs &&
try-to sudo bash docker-defs/dockin.sh
add-ppas ppa:git-core/ppa ppa:jonathonf/vim ppa:libreoffice/ppa multiverse ppa:nextcloud-devs/client ppa:ubuntu-wine/ppa
# Install steam and wine last, as they require user input
try-to paf -i -y git vim libreoffice nextcloud-client steam wine
}
(install-my-tools)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment