#!/bin/sh # Usage: # curl -sfL https://manidakis.com | sh -s - /root set -e set -o noglob TMUXURI=https://manidakis.com/tmux VIMRCURI=https://manidakis.com/vimrc BASHRCURI=https://manidakis.com/bashrc BASEDIR=$1 info() { echo '[INFO] ' "$@" } update_system() { info "Updating system" apt update && apt upgrade -y } install_dependencies() { info "Installing dependencies" apt install git vim tmux fzf } check_if_exists_and_backup() { if [ -f "$1" ]; then mv $1 $1.bck fi } create_tmux_config() { info "Creating tmux config" curl -sfL $TMUXURI >$BASEDIR/.tmux.conf } create_vimrc_config() { info "Creating vimrc config" curl -sfL $VIMRCURI >$BASEDIR/.vimrc } create_bashrc_config() { info "Creating bashrc config" curl -sfL $BASHRCURI >$BASEDIR/.bashrc } backup_current_configs() { info "Backup current configs" check_if_exists_and_backup $BASEDIR/.vimrc check_if_exists_and_backup $BASEDIR/.tmux.conf check_if_exists_and_backup $BASEDIR/.bashrc } create_configs() { create_tmux_config create_vimrc_config create_bashrc_config } { update_system install_dependencies backup_current_configs create_tmux_config create_vimrc_config create_bashrc_config }