OSDN Git Service

fix small bugs
[instantos/instantOS.git] / install.sh
1 #!/bin/bash
2 # central installer script for pb suckless
3
4 if [ $(whoami) = "root" ] || [ $(whoami) = "manjaro" ]; then
5     echo "user check successful"
6 else
7     echo "please run this as root"
8     exit 1
9 fi
10
11 RAW="https://raw.githubusercontent.com"
12
13 if cat /etc/os-release | grep -Eiq 'name.*(arch|manjaro|ubuntu)'; then
14     curl -s "$RAW/instantOS/instantLOGO/master/ascii.txt"
15 else
16     echo "distro not supported"
17     echo "supported are: Arch, Manjaro, Ubuntu"
18     exit
19 fi
20
21 REALUSERS="$(ls /home/ | grep -v '+')"
22 export THEME=${1:-dracula}
23
24 # run a tool as every existing
25 # "real"(there's a human behind it) user
26
27 userrun() {
28     rm -rf /tmp/instantinstall.sh &> /dev/null
29     curl -Ls "$1" >/tmp/instantinstall.sh
30     chmod 777 /tmp/instantinstall.sh
31
32     if [ -n "$2" ] && getent passwd $2 && [ -e /home/$2 ]; then
33         echo "single user installation for $1"
34         sudo su "$2" -c /tmp/instantinstall.sh
35     else
36         for i in $REALUSERS; do
37             echo "processing user $i"
38             sudo su "$i" -c /tmp/instantinstall.sh
39         done
40     fi
41     rm /tmp/instantinstall.sh
42 }
43
44 echo "installing dependencies"
45 curl -s $RAW/paperbenni/suckless/master/depend.sh | bash
46
47 echo "installing tools"
48 curl -s $RAW/paperbenni/suckless/master/rootinstall.sh | bash
49 userrun "$RAW/paperbenni/suckless/master/userinstall.sh"
50
51 echo "installing theme"
52 userrun "$RAW/instantOS/instantTHEMES/master/$THEME.sh"
53
54 echo "installing dotfiles"
55 curl -s $RAW/paperbenni/dotfiles/master/rootinstall.sh | bash
56 userrun $RAW/paperbenni/dotfiles/master/install.sh