浏览代码

Now automatically installs various things

master
mort 9 年前
父节点
当前提交
2b7d0faa6b
共有 6 个文件被更改,包括 115 次插入6 次删除
  1. 2
    0
      .gitignore
  2. 1
    1
      bin/mupload
  3. 17
    0
      install/i3wm.sh
  4. 6
    0
      install/mrec.sh
  5. 3
    0
      install/sxhkd.sh
  6. 86
    5
      setup.sh

+ 2
- 0
.gitignore 查看文件

@@ -0,0 +1,2 @@
.installed
out.log

+ 1
- 1
bin/mupload 查看文件

@@ -10,7 +10,7 @@ fi

URL="http://d.mort.coffee/$2"
echo $URL | xsel -ib
scp "$1" "martin@serve.mort.coffee:/var/www/mort.coffee/d/public/$2"
scp "$1" "martin@serve.mort.coffee:/var/www/mort.coffee/d/public/content/$2"
if [ $? -eq 0 ]; then
echo $URL
else

+ 17
- 0
install/i3wm.sh 查看文件

@@ -0,0 +1,17 @@
echo "am install i3 for OS $OS"

case $OS in
ubuntu)
printf "%s\n" \
"Package: i3*" \
"Pin: origin \"build.i3wm.org\"" \
"Pin-Priority: 1001" \
| sudo tee /etc/apt/preferences.d/00-i3-autobuild.pref > /dev/null

sudo apt-get update
sudo apt-get install i3 -y
;;
*)
exit 1
;;
esac

+ 6
- 0
install/mrec.sh 查看文件

@@ -0,0 +1,6 @@
res=$(xdpyinfo | awk '/dimensions:/ { print $2; exit }')

echo "X=0" >> "$HOME/.mrecrc"
echo "Y=0" >> "$HOME/.mrecrc"
echo "W=$(echo $res | cut -d x -f 1)" >> "$HOME/.mrecrc"
echo "H=$(echo $res | cut -d x -f 2)" >> "$HOME/.mrecrc"

+ 3
- 0
install/sxhkd.sh 查看文件

@@ -0,0 +1,3 @@
git clone https://github.com/baskerville/sxhkd.git .
make
sudo make install

+ 86
- 5
setup.sh 查看文件

@@ -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!"

正在加载...
取消
保存