OSDN Git Service

add youtube-dl and xclip
[instantos/instantOS.git] / install.sh
old mode 100644 (file)
new mode 100755 (executable)
index c471d5c..c172e5b
@@ -1,59 +1,72 @@
-#!/usr/bin/env bash
-echo "installing paperbenni's suckless suite"
+#!/bin/bash
+# central installer script for instantOS
 
-source <(curl -s https://raw.githubusercontent.com/paperbenni/bash/master/import.sh)
-pb install
+export PAPERSILENT="True"
 
-pinstall dash slop ffmpeg wmctrl
-
-gclone() {
-    git clone --depth=1 https://github.com/paperbenni/"$1".git
-}
+if [ $(whoami) = "root" ] || [ $(whoami) = "manjaro" ]; then
+    echo "user check successful"
+else
+    echo "please run this as root"
+    exit 1
+fi
 
-mkdir -p ~/.local/share/fonts
+RAW="https://raw.githubusercontent.com"
 
-pushd ~/.local/share/fonts
-if ! [ -e monaco.ttf ]; then
-    wget https://github.com/todylu/monaco.ttf/raw/master/monaco.ttf
+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
-popd
-
-rm -rf ~/suckless
-mkdir ~/suckless
-cd ~/suckless
-
-gclone dwm
-gclone dmenu
-gclone st
-gclone slock
-
-wget https://raw.githubusercontent.com/paperbenni/suckless/master/dwm.desktop
-wget https://raw.githubusercontent.com/paperbenni/suckless/master/startdwm
-sudo mv startdwm /bin/
-sudo chmod +x /bin/startdwm
-sudo mv dwm.desktop /usr/share/xsessions/
-
-for FOLDER in ./*; do
-    if ! [ -d "$FOLDER" ]; then
-        echo "skipping $FOLDER"
-        continue
+
+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
-    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
-fi
+    rm /tmp/instantinstall.sh
+}
+
+rootrun() {
+    if [[ "$1" =~ "/" ]]; then
+        RUNSCRIPT="$1"
+    else
+        RUNSCRIPT="$RAW/instantos/instantos/master/$1"
+    fi
+    shift
+    curl -s "$RUNSCRIPT" | bash -s $@
+}
+
+echo "installing dependencies"
+rootrun depend.sh
+
+echo "root: installing tools"
+rootrun rootinstall.sh "$1"
+
+userrun "$RAW/instantos/instantos/master/userinstall.sh"
 
-# install window switcher
-LINK="https://raw.githubusercontent.com/paperbenni/suckless/master"
+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"