#!/bin/sh # A file used to automaticaly copy configs and macros to their appropriate # location CONFIGS=~/Source/configs MACROS=~/Source/macros # Copy a script over to /usr/local/bin and make it executable. Accepts the full # path of a file copy() { if [ ! -e $1 ]; then return 1; fi sudo cp $1 /usr/local/bin/ sudo chmod a+x /usr/local/bin/$(basename $1) printf "Copied and made executable: %s\n" $(basename $1) } # Exclude files with extensions like .c or .sh that are not executable or # are incomplete and copy them over macros() { for f in $(find ~/Source/macros -maxdepth 1 -type f -not -name '*.*') do copy "$f" done } # Rebuilds selected custom applications builds() { for f in ~/Source/enabled/* do cd $f git -C $f pull sudo make clean install done } vim() { sudo cp ~/Source/configs/vimrc.local /etc/vim/vimrc.local # Should copy plugins too } neomutt() { sudo cp -r $CONFIGS/neomutt $XDG_CONFIG_HOME/ } mbsync() { cp $CONFIGS/mbsyncrc ~/.mbsyncrc } bash() { cp $CONFIGS/.bashrc ~/.bashrc cp $CONFIGS/.profile ~/.profile } rtorrent() { cp $CONFIGS/.rtorrentrc } xsession() { cp $CONFIGS/.xsession ~/ } installs() { ls } # Used to configure a new system or reset things for an existing one. all() { vim; neomutt; mbsync; bash; rtorrent; xsession } case $1 in configure) copy $MACROS/configure;; builds) builds;; vim) vim;; macros) macros;; rtorrent) rtorrent;; neomutt) neomutt;; bash) bash;; mbsync) mbsync;; xsession) xsession;; all) all;; *) printf "Invalid argument\n";; esac