-#!/usr/bin/env bash
+#!/bin/bash
+# central installer script for instantOS
-#############################################
-## installs all paperbenni suckless forks ##
-## made for personal use, so be warned ;) ##
-#############################################
+export PAPERSILENT="True"
-echo "installing paperbenni's suckless suite"
-
-source <(curl -s https://raw.githubusercontent.com/paperbenni/bash/master/import.sh)
-pb install
-
-# pinstall dash slop ffmpeg wmctrl
-
-gclone() {
- git clone --depth=1 https://github.com/paperbenni/"$1".git
-}
-
-gprogram() {
- wget "https://raw.githubusercontent.com/paperbenni/suckless/master/programs/$1"
- sudo mv $1 /bin/
- sudo chmod +x /bin/$1
-}
-
-mkdir -p ~/.local/share/fonts
-
-pushd ~/.local/share/fonts
-if ! [ -e monaco.ttf ]; then
- wget https://github.com/todylu/monaco.ttf/raw/master/monaco.ttf
+if [ $(whoami) = "root" ] || [ $(whoami) = "manjaro" ]; then
+ echo "user check successful"
+else
+ echo "please run this as root"
+ exit 1
fi
-popd
-
-rm -rf ~/suckless
-mkdir ~/suckless
-cd ~/suckless
-
-gclone dwm
-gclone dmenu
-gclone st
-gclone slock
-# session for lightdm
-wget https://raw.githubusercontent.com/paperbenni/suckless/master/dwm.desktop
-sudo mv dwm.desktop /usr/share/xsessions/
+RAW="https://raw.githubusercontent.com"
-gprogram startdwm
-gprogram sucklessshutdown
-
-for FOLDER in ./*; do
- if ! [ -d "$FOLDER" ]; then
- echo "skipping $FOLDER"
- continue
- fi
- pushd "$FOLDER"
- rm config.h
- make
- sudo make install
- popd
-done
-
-if ! [ -z "$1" ]; then
- curl https://raw.githubusercontent.com/paperbenni/dotfiles/master/install.sh | bash
+if cat /etc/os-release | grep -Eiq 'name.*(arch|manjaro|ubuntu)'; then
+ curl -s "$RAW/instantOS/instantLOGO/master/ascii.txt"
+ echo ""
+else
+ echo "distro not supported"
+ echo "supported are: Arch, Manjaro, Ubuntu"
+ exit
fi
-# install window switcher
-LINK="https://raw.githubusercontent.com/paperbenni/suckless/master"
-
-if cat /etc/os-release | grep -i 'arch'; then
- echo "setting up arch specific stuff"
- # auto start script with dwm
- ls ~/.dwm || mkdir ~/.dwm
- curl $LINK/autostart.sh >~/.dwm/autostart.sh
- if ! command -v compton; then
- sudo pacman --noconfirm -S compton
+REALUSERS="$(ls /home/ | grep -v '+')"
+export THEME=${1:-dracula}
+
+# run a tool as every existing
+# "real"(there's a human behind it) user
+
+userrun() {
+ rm -rf /tmp/instantinstall.sh &>/dev/null
+ curl -s "$1" >/tmp/instantinstall.sh
+ chmod 777 /tmp/instantinstall.sh
+
+ if [ -n "$2" ] && getent passwd $2 && [ -e /home/$2 ]; then
+ echo "single user installation for $1"
+ sudo su "$2" -c /tmp/instantinstall.sh
+ else
+ for i in $REALUSERS; do
+ echo "processing user $i"
+ sudo su "$i" -c /tmp/instantinstall.sh
+ done
fi
+ rm /tmp/instantinstall.sh
+}
-fi
-
-# install notification-center
-if ! command -v deadd; then
- # remove faulty installation
- sudo rm /usr/bin/deadd &>/dev/null
- sudo rm /usr/bin/deaddcenter &>/dev/null
+rootrun() {
+ if [[ "$1" =~ "/" ]]; then
+ RUNSCRIPT="$1"
+ else
+ RUNSCRIPT="$RAW/instantos/instantos/master/$1"
+ fi
+ shift
+ curl -s "$RUNSCRIPT" | bash -s $@
+}
- # main binary
- curl -s $LINK/bin/deadd.xz >deadd.xz
- xz -d deadd.xz
- sudo mv deadd /usr/bin/deadd
- sudo chmod +x /usr/bin/deadd
+echo "installing dependencies"
+rootrun depend.sh
- # toggle script
- curl -s $LINK/bin/deaddcenter >deaddcenter
- sudo mv deaddcenter /usr/bin/deaddcenter
- sudo chmod +x /usr/bin/deaddcenter
-fi
+echo "root: installing tools"
+rootrun rootinstall.sh "$1"
-# notification program for deadd-center
-git clone --depth=2 https://github.com/phuhl/notify-send.py &>/dev/null
-cd notify-send.py
-sudo pip2 install notify2
-sudo python3 setup.py install
-cd ..
-sudo rm -rf notify-send.py
+userrun "$RAW/instantos/instantos/master/userinstall.sh"
-mkdir -p ~/.config/deadd
-curl $LINK/deadd.conf >~/.config/deadd/deadd.conf
+echo "installing theme"
+userrun "$RAW/instantOS/instantTHEMES/master/$THEME.sh"
-curl "$LINK/dswitch" | sudo tee /usr/local/bin/dswitch
-sudo chmod +x /usr/local/bin/dswitch
+echo "installing dotfiles"
+rootrun $RAW/paperbenni/dotfiles/master/rootinstall.sh
+userrun $RAW/paperbenni/dotfiles/master/userinstall.sh
-# install win + a menus for screenshots
-curl https://raw.githubusercontent.com/paperbenni/menus/master/install.sh | bash
+userrun "$RAW/instantos/instantos/master/userdepend.sh"