|
|
@@ -1,6 +1,20 @@ |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
export OS=$(awk '/DISTRIB_ID=/' /etc/*-release | sed 's/DISTRIB_ID=//' | tr '[:upper:]' '[:lower:]') |
|
|
|
|
|
|
|
case $OS in |
|
|
|
ubuntu) |
|
|
|
;; |
|
|
|
*) |
|
|
|
echo "Unsupported OS: ${OS}." |
|
|
|
exit 1 |
|
|
|
esac |
|
|
|
|
|
|
|
rm out.log &>/dev/null |
|
|
|
mkdir .installed &>/dev/null |
|
|
|
|
|
|
|
issues=0 |
|
|
|
|
|
|
|
check_command() |
|
|
|
{ |
|
|
|
which "$1" &> /dev/null |
|
|
@@ -10,7 +24,6 @@ check_command() |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
issues=0 |
|
|
|
check_file() |
|
|
|
{ |
|
|
|
if [ ! -f "$1" ]; then |
|
|
@@ -19,28 +32,86 @@ check_file() |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
check_dep() |
|
|
|
{ |
|
|
|
dep="" |
|
|
|
|
|
|
|
case $OS in |
|
|
|
ubuntu) |
|
|
|
case $1 in |
|
|
|
xcb_keysym.h) |
|
|
|
dep="libxcb-keysyms1-dev" |
|
|
|
;; |
|
|
|
xcb.h) |
|
|
|
dep="libxcb-util0-dev" |
|
|
|
;; |
|
|
|
esac |
|
|
|
;; |
|
|
|
esac |
|
|
|
|
|
|
|
exists=0 |
|
|
|
case $OS in |
|
|
|
ubuntu) |
|
|
|
dpkg -s "$dep" &> /dev/null |
|
|
|
exists="$?" |
|
|
|
;; |
|
|
|
esac |
|
|
|
|
|
|
|
if [ ! $exists ]; then |
|
|
|
if [ "$dep" = "" ]; then |
|
|
|
echo "Missing dependency: $1" |
|
|
|
else |
|
|
|
echo "Missing dependency: $dep" |
|
|
|
fi |
|
|
|
issues=1 |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
install_setup() |
|
|
|
{ |
|
|
|
if [ -f ".installed/$1" ]; then |
|
|
|
echo "$1 is already installed, skipping." |
|
|
|
return |
|
|
|
fi |
|
|
|
|
|
|
|
echo "Installing ${1}..." |
|
|
|
DIR=$(mktemp -d) |
|
|
|
CDIR=$(pwd) |
|
|
|
cd $DIR |
|
|
|
echo "\n\nINSTALL: $1" >> "$CDIR/out.log" |
|
|
|
sh "$CDIR/install/${1}.sh" &>> "$CDIR/out.log" |
|
|
|
if [ ! $? ]; then |
|
|
|
echo "An error occurred while installing ${1}. See out.log for more information." |
|
|
|
else |
|
|
|
touch "$CDIR/.installed/$1" |
|
|
|
echo "Done." |
|
|
|
fi |
|
|
|
cd "$CDIR" |
|
|
|
} |
|
|
|
|
|
|
|
check_command "zsh" |
|
|
|
check_command "tmux" |
|
|
|
check_command "vim" |
|
|
|
check_command "python" |
|
|
|
check_command "xdotool" |
|
|
|
check_command "i3" |
|
|
|
check_command "compton" |
|
|
|
check_command "amixer" |
|
|
|
check_command "xbacklight" |
|
|
|
check_command "feh" |
|
|
|
check_command "xsel" |
|
|
|
check_command "sxhkd" |
|
|
|
check_command "recordmydesktop" |
|
|
|
check_command "mplayer" |
|
|
|
check_command "scrot" |
|
|
|
check_command "notify-send" |
|
|
|
check_command "dunst" |
|
|
|
check_command "curl" |
|
|
|
check_command "sudo" |
|
|
|
|
|
|
|
check_file ~/.mrecrc |
|
|
|
check_dep "xcb.h" |
|
|
|
check_dep "xcb_keysym.h" |
|
|
|
|
|
|
|
if [ $issues -ne 0 ]; then |
|
|
|
echo "Some commands or files are missing. Continue? (y/n)" |
|
|
|
echo "Some things are missing. Continue? (y/n)" |
|
|
|
read response |
|
|
|
if [ "$response" != "y" ]; then |
|
|
|
echo "Aborting." |
|
|
@@ -87,10 +158,20 @@ while getopts :m option; do |
|
|
|
echo "Not switching mod and alt keys." |
|
|
|
echo "" > ~/.Xmodmaprc |
|
|
|
;; |
|
|
|
f) |
|
|
|
echo "Forcing a recompile of packages." |
|
|
|
rm .installed/* |
|
|
|
;; |
|
|
|
*) |
|
|
|
echo "Unknown option: $option" |
|
|
|
;; |
|
|
|
esac |
|
|
|
done |
|
|
|
|
|
|
|
install_setup "sxhkd" |
|
|
|
install_setup "i3wm" |
|
|
|
install_setup "mrec" |
|
|
|
|
|
|
|
sudo chsh "$USER" -s /bin/zsh |
|
|
|
|
|
|
|
echo "Everything set up!" |