-#!/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
-pb git
-
-LINK="https://raw.githubusercontent.com/paperbenni/suckless/master"
-
-gprogram() {
- wget "https://raw.githubusercontent.com/paperbenni/suckless/master/programs/$1"
- usrbin -f "$1"
-}
-
-if [ "$1" = "dotfiles" ]; then
- shift 1
- DOTFILES="True"
-fi
-
-THEME="${1:-dracula}"
-echo "using theme $THEME"
-[ -e ~/paperbenni ] || mkdir ~/paperbenni
-echo "$THEME" >~/paperbenni/.theme
-
-rm -rf suckless
-mkdir suckless
-cd suckless
-
-gitclone dwm
-gitclone dmenu
-gitclone st
-
-# needed for slock
-if grep -q 'nobody' </etc/groups || grep -q 'nobody' </etc/group; then
- echo "nobody workaround not required"
+if [ $(whoami) = "root" ] || [ $(whoami) = "manjaro" ]; then
+ echo "user check successful"
else
- sudo groupadd nobody
+ echo "please run this as root"
+ exit 1
fi
-# add group and add user to group
-ugroup() {
- if groups | grep -q "$1"; then
- echo "user is member of $1"
- return
- else
- sudo groupadd "$1"
- sudo gpasswd -a $USER $1
- fi
-}
-
-ugroup video
-ugroup input
-
-gitclone slock
+RAW="https://raw.githubusercontent.com"
-# install cursors for themes
-if ! [ -e ~/.icons/osx ]; then
- curl -s https://raw.githubusercontent.com/paperbenni/cursors/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
-# session for lightdm
-wget https://raw.githubusercontent.com/paperbenni/suckless/master/dwm.desktop
-sudo mv dwm.desktop /usr/share/xsessions/
-
-# x session wrapper
-gprogram startdwm
-# shutdown popup that breaks restart loop
-gprogram sucklessshutdown
-
-gprogram autoclicker
+REALUSERS="$(ls /home/ | grep -v '+')"
+export THEME=${1:-dracula}
-# dmenu run but in terminal emulator st
-# only supported terminal apps (less to search through)
-gprogram dmenu_run_st
+# run a tool as every existing
+# "real"(there's a human behind it) user
-gprogram dswitch
-gprogram pbnotify
+userrun() {
+ rm -rf /tmp/instantinstall.sh &>/dev/null
+ curl -s "$1" >/tmp/instantinstall.sh
+ chmod 777 /tmp/instantinstall.sh
-# for that extra kick when doingg a typo
-gprogram sll
-
-curl "$LINK/termprograms.txt" >~/.cache/termprograms.txt
-
-for FOLDER in ./*; do
- if ! [ -d "$FOLDER" ]; then
- echo "skipping $FOLDER"
- continue
- fi
- pushd "$FOLDER"
- if ! [ -e build.sh ]; then
- rm config.h
- make
- sudo make install
+ if [ -n "$2" ] && getent passwd $2 && [ -e /home/$2 ]; then
+ echo "single user installation for $1"
+ sudo su "$2" -c /tmp/instantinstall.sh
else
- chmod +x ./build.sh
- ./build.sh "$THEME"
- fi
- popd
-done
-
-# install dotfiles like bash,git and tmux config
-if [ -n "$DOTFILES" ]; then
- curl https://raw.githubusercontent.com/paperbenni/dotfiles/master/install.sh | bash
-fi
-
-if ! [ ~/.local/share/fonts/symbola.ttf ]; then
- mkdir -p ~/.local/share/fonts
- cd ~/.local/share/fonts
- wget "http://symbola.surge.sh/symbola.ttf"
-fi
-
-cd
-
-# laptop specific stuff
-if acpi | grep -q '[0-9]%'; then
- # config file to indicate being a laptop
- touch .cache/islaptop
-
- # fix tap to click not working with tiling wms
- if ! [ -e /etc/X11/xorg.conf.d/90-touchpad.conf ] ||
- ! cat /etc/X11/xorg.conf.d/90-touchpad.conf | grep -iq 'tapping.*"on"'; then
-
- sudo mkdir -p /etc/X11/xorg.conf.d && sudo tee /etc/X11/xorg.conf.d/90-touchpad.conf <<'EOF' 1>/dev/null
-Section "InputClass"
- Identifier "touchpad"
- MatchIsTouchpad "on"
- Driver "libinput"
- Option "Tapping" "on"
-EndSection
-
-EOF
+ for i in $REALUSERS; do
+ echo "processing user $i"
+ sudo su "$i" -c /tmp/instantinstall.sh
+ done
fi
+ rm /tmp/instantinstall.sh
+}
-fi
-
-curl -s "https://raw.githubusercontent.com/paperbenni/suckless/master/monitor.sh" | bash
-cd
-
-# three and four finger swipes on laptop
-if ! command -v libinput-gestures &>/dev/null; then
- cd /tmp
- git clone --depth=1 https://github.com/bulletmark/libinput-gestures.git
- cd libinput-gestures
- sudo make install
- cd ..
- rm -rf libinput-gestures
-fi
-
-cd
-
-# auto start script with dwm
-ls .dwm &>/dev/null || mkdir .dwm
-curl $LINK/autostart.sh >.dwm/autostart.sh
-chmod +x .dwm/autostart.sh
-
-# set up multi monitor config for dswitch
-if ! [ -e paperbenni/ismultimonitor ]; then
- if xrandr | grep ' connected' | grep -Eo '[0-9]{3,}x' |
- grep -o '[0-9]*' | wc -l | grep '2'; then
- mkdir paperbenni &>/dev/null
- xrandr | grep ' connected' | grep -Eo '[0-9]{3,}x' |
- grep -o '[0-9]*' >paperbenni/ismultimonitor
- echo "$(wc -l paperbenni/ismultimonitor) monitors detected"
+rootrun() {
+ if [[ "$1" =~ "/" ]]; then
+ RUNSCRIPT="$1"
else
- echo "not a multi monitor setup"
+ RUNSCRIPT="$RAW/instantos/instantos/master/$1"
fi
-else
- echo "monitor config: "
- cat paperbenni/ismultimonitor
- echo ""
-fi
-
-cd
-
-# install wmutils
-if ! command -v pfw &>/dev/null; then
- cd /tmp
- if git clone --depth=1 https://github.com/wmutils/core.git; then
- cd core
- make
- sudo make install
- cd ..
- rm -rf core
- fi
-fi
-
-cd
-
-# install win + a menus for shortcuts like screenshots and shutdown
-curl https://raw.githubusercontent.com/paperbenni/menus/master/install.sh | bash
-
-# drag and drop x utility for ranger
-if ! command -v dragon &>/dev/null; then
- cd /tmp
- git clone --depth=1 https://github.com/mwh/dragon.git
- cd dragon
- make
- make install
- cd ..
- rm -rf dragon
-fi
+ shift
+ curl -s "$RUNSCRIPT" | bash -s $@
+}
-cd
-mkdir paperbenni &>/dev/null
+echo "installing dependencies"
+rootrun depend.sh
-# automatic wallpaper changer
-# uses reddit r/wallpaper scraper
-if [ "$2" = "rwall" ]; then
- cd /tmp
- gitclone rwallpaper
- cd rwallpaper
- mv rwallpaper.py ~/paperbenni/
- chmod +x wallpaper.sh
- mv wallpaper.sh ~/paperbenni/
- sudo pip3 install -r requirements.txt
- cd ..
- rm -rf rwallpaper
-fi
+echo "root: installing tools"
+rootrun rootinstall.sh "$1"
-cd
+userrun "$RAW/instantos/instantos/master/userinstall.sh"
-# set dwm as default for lightdm
-echo '[Desktop]' >.dmrc
-echo 'Session=dwm' >>.dmrc
-if [ -e /etc/lightdm/lightdm.conf ]; then
- sudo sed -i 's/^user-session=.*/user-session=dwm/g' /etc/lightdm/lightdm.conf
-fi
+echo "installing theme"
+userrun "$RAW/instantOS/instantTHEMES/master/$THEME.sh"
-# install things like fonts or gtk theme
-if ! [ -e .config/paperthemes/$THEME.txt ]; then
- echo "installing theme"
- curl -s "https://raw.githubusercontent.com/paperbenni/suckless/master/themes/$THEME.sh" | bash
- mkdir .config/paperthemes
- touch .config/paperthemes/$THEME.txt
-else
- echo "theme installation already found"
-fi
+echo "installing dotfiles"
+rootrun $RAW/paperbenni/dotfiles/master/rootinstall.sh
+userrun $RAW/paperbenni/dotfiles/master/userinstall.sh
-# fix java gui appearing empty on dwm
-if ! grep 'dwm' </etc/profile; then
- echo "fixing java windows for dwm in /etc/profile"
- echo '# fix dwm java windows' | sudo tee -a /etc/profile
- echo 'export _JAVA_AWT_WM_NONREPARENTING=1' | sudo tee -a /etc/profile
-else
- echo "java workaround already applied"
-fi
+userrun "$RAW/instantos/instantos/master/userdepend.sh"