OSDN Git Service

start supporting multi user installers for local changes
authorpaperbenni <paperbenni@gmail.com>
Sun, 12 Jan 2020 15:19:10 +0000 (16:19 +0100)
committerpaperbenni <paperbenni@gmail.com>
Sun, 12 Jan 2020 15:19:10 +0000 (16:19 +0100)
depend.sh
dotinstall.sh [deleted file]
install.sh
rootinstall.sh [new file with mode: 0644]
userinstall.sh [new file with mode: 0755]

index 1ab2efc..22830ee 100644 (file)
--- a/depend.sh
+++ b/depend.sh
@@ -49,7 +49,7 @@ if cat /etc/os-release | grep -iq 'name.*arch' ||
     sudo pacman -Syu --noconfirm
 
     pacinstall picom
-
+    pacinstall arc-gtk-theme
     pacinstall acpi
     pacinstall xrandr
 
@@ -84,6 +84,7 @@ if grep -iq 'name.*ubuntu' </etc/os-release; then
 
     aptinstall cpio
     aptinstall tar
+    aptinstall arc-theme
 
     if ! command -v panther_launcher; then
         wget "https://www.rastersoft.com/descargas/panther_launcher/panther-launcher-xenial_1.12.0-ubuntu1_amd64.deb"
diff --git a/dotinstall.sh b/dotinstall.sh
deleted file mode 100755 (executable)
index 00afad5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# central installer script for pb suckless
-
-if cat /etc/os-release | grep -Eiq 'name.*(arch|manjaro|ubuntu)'; then
-
-curl -s "https://raw.githubusercontent.com/instantOS/instantLOGO/master/ascii.txt"
-
-else
-    echo "distro not supported"
-    echo "supported are: Arch, Manjaro, Ubuntu"
-    exit
-fi
-
-echo "installing dependencies"
-curl -s https://raw.githubusercontent.com/paperbenni/suckless/master/depend.sh | bash
-echo "installing tools"
-curl -s https://raw.githubusercontent.com/paperbenni/suckless/master/install.sh | bash
-echo "installing theme"
-export THEME=${1:-dracula}
-curl -s "https://raw.githubusercontent.com/instantOS/instantTHEMES/master/$THEME.sh" | bash
-
-echo "installing dotfiles"
-curl -s https://raw.githubusercontent.com/paperbenni/dotfiles/master/install.sh | bash
index ffe8fb7..a018047 100755 (executable)
-#!/usr/bin/env bash
+#!/bin/bash
+# central installer script for pb suckless
 
-#############################################
-## installs all instantOS tools            ##
-#############################################
-
-echo "installing instantOS tools"
-
-RAW="https://raw.githubusercontent.com"
-source <(curl -s $RAW/paperbenni/bash/master/import.sh)
-pb install
-pb git
-
-LINK="$RAW/paperbenni/suckless/master"
-
-# fetches and installs program from this repo
-gprogram() {
-    echo "installing $1"
-    wget -q "$RAW/paperbenni/suckless/master/programs/$1"
-    usrbin -f "$1"
-}
-
-gclone() {
-    echo "cloning $1"
-    gitclone $@ &>/dev/null
-}
-
-iclone() {
-    echo "cloning $1"
-    gitclone instantOS/$@ &>/dev/null
-}
-
-# adds permanent global environment variable
-addenv() {
-    [ -e /etc/environment ] || sudo touch /etc/environment
-    if [ "$1" = "-f" ]; then
-        local FORCE="true"
-        shift 1
-    fi
-
-    if grep -q "$1=" /etc/environment; then
-        if [ -z "$FORCE" ]; then
-            echo "key already there"
-            return 1
-        else
-            sudo sed -i "s/$1=.*/$1=$2/g" /etc/environment
-        fi
-    else
-        echo "$1=$2" | sudo tee -a /etc/environment
-    fi
-}
-
-addenv -f "QT_QPA_PLATFORMTHEME" "qt5ct"
-command -v nvim &>/dev/null && addenv -f "EDITOR" "$(which nvim)"
-
-THEME="${1:-dracula}"
-echo "using theme $THEME"
-[ -e ~/paperbenni ] || mkdir ~/paperbenni
-echo "$THEME" >~/paperbenni/.theme
-
-rm -rf suckless
-mkdir suckless
-cd suckless
-
-iclone instantWM
-
-#iclone instantMENU // weiter
-
-# 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
-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
-
-gclone slock
-
-
-for FOLDER in ./*; do
-    if ! [ -d "$FOLDER" ]; then
-        echo "skipping $FOLDER"
-        continue
-    fi
-    pushd "$FOLDER"
-    if ! [ -e build.sh ]; then
-        rm config.h
-        make &>/dev/null
-        sudo make install &>/dev/null
-    else
-        chmod +x ./build.sh
-        ./build.sh "$THEME" &>/dev/null
-    fi
-    popd
-done
-
-# session for lightdm
-wget -q $RAW/paperbenni/suckless/master/instantwm.desktop
-sudo mv instantwm.desktop /usr/share/xsessions/
-
-# x session wrapper
-gprogram startinstantwm
-# shutdown popup that breaks restart loop
-gprogram instantshutdown
-
-gprogram autoclicker
-
-# dmenu run but in terminal emulator st
-# only supported terminal apps (less to search through)
-gprogram instantterm
-
-gprogram instantswitch
-gprogram instantnotify
-
-# for that extra kick when doingg a typo
-gprogram sll
-
-curl "$LINK/termprograms.txt" >~/.cache/termprograms.txt
-
-if ! [ ~/.local/share/fonts/symbola.ttf ]; then
-    mkdir -p ~/.local/share/fonts
-    cd ~/.local/share/fonts
-    echo "installing symbola font"
-    wget -q "http://symbola.surge.sh/symbola.ttf"
+    echo "please run this as root"
+    exit 1
 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
-    fi
-
-fi
-
-curl -s "$RAW/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
+if cat /etc/os-release | grep -Eiq 'name.*(arch|manjaro|ubuntu)'; then
+    curl -s "https://raw.githubusercontent.com/instantOS/instantLOGO/master/ascii.txt"
+else
+    echo "distro not supported"
+    echo "supported are: Arch, Manjaro, Ubuntu"
+    exit
 fi
 
-cd
+REALUSERS="$(ls /home/ | grep -v '+')"
+RAW="https://raw.githubusercontent.com"
+export THEME=${1:-dracula}
 
-# auto start script with instantWM
-ls .instantos &>/dev/null || mkdir .instantos
-curl $LINK/autostart.sh >.instantos/autostart.sh
-chmod +x .instantos/autostart.sh
+# run a tool as every existing user
+userrun() {
+    curl -s "$1" >/tmp/instantinstall.sh
+    chmod 777 /tmp/instantinstall.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 -q '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"
+    if [ -n "$2" ] && getent passwd $2 && [ -e /home/$2 ]; then
+        echo "single user installation for $1"
+        sudo su "$2" -c bash /tmp/instantinstall.sh
     else
-        echo "not a multi monitor setup"
+        for i in $REALUSERS; do
+            sudo su "$i" -c bash /tmp/instantinstall.sh
+        done
     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 -s $RAW/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 &>/dev/null
-    cd dragon
-    make
-    make install
-    cd ..
-    rm -rf dragon
-fi
-
-cd
-mkdir -p paperbenni/notifications &>/dev/null
+    rm /tmp/instantinstall.sh
+}
 
-# gets executed by dunst on notification
-curl "$RAW/paperbenni/suckless/master/programs/dunsttrigger" >~/paperbenni/notifications/dunsttrigger
-chmod +x ~/paperbenni/notifications/dunsttrigger
-wget -O ~/paperbenni/notifications/notification.ogg "https://notificationsounds.com/notification-sounds/me-too-603/download/ogg"
+echo "installing dependencies"
+curl -s $RAW/paperbenni/suckless/master/depend.sh | bash
 
-cd
-mkdir instantos/wallpapers
-curl -s "$RAW/instantOS/instantWALLPAPER/master/wall.sh" > intantos/wallpapers/wall.sh
-chmod +x intantos/wallpapers/wall.sh
+echo "installing tools"
+curl -s $RAW/paperbenni/suckless/master/rootinstall.sh | bash
+userrun "$RAW/paperbenni/suckless/master/userinstall.sh"
 
-# set instantwm as default for lightdm
-echo '[Desktop]' >.dmrc
-echo 'Session=instantwm' >>.dmrc
-if [ -e /etc/lightdm/lightdm.conf ]; then
-    sudo sed -i 's/^user-session=.*/user-session=instantwm/g' /etc/lightdm/lightdm.conf
-fi
+echo "installing theme"
+userrun "$RAW/instantOS/instantTHEMES/master/$THEME.sh"
 
-# fix java gui appearing empty on instantWM
-if ! grep -q 'instantwm' </etc/profile; then
-    echo "fixing java windows for instantwm in /etc/profile"
-    echo '# fix instantwm 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
+echo "installing dotfiles"
+curl -s $RAW/paperbenni/dotfiles/master/install.sh | bash
diff --git a/rootinstall.sh b/rootinstall.sh
new file mode 100644 (file)
index 0000000..5e329a9
--- /dev/null
@@ -0,0 +1,167 @@
+#!/bin/bash
+
+######################################################
+## installs all system wide programs for instantOS  ##
+######################################################
+
+if ! [ $(whoami) = "root" ]; then
+    echo "please run this as root"
+    exit 1
+fi
+
+mkdir -p /opt/instantos
+
+# add group and add users to group
+ugroup() {
+    groupadd "$1"
+    for USER in $(ls /home/ | grep -v '+'); do
+        sudo gpasswd -a $USER $1
+    done
+}
+
+ugroup video
+ugroup input
+
+RAW="https://raw.githubusercontent.com"
+
+# fetches and installs program from this repo
+gprogram() {
+    echo "installing $1"
+    curl -s "$RAW/paperbenni/suckless/master/programs/$1" | sudo tee /usr/bin/$1 &>/dev/null
+    chmod +x /usr/bin/"$1"
+}
+
+# x session wrapper
+gprogram startinstantwm
+# shutdown popup that breaks restart loop
+gprogram instantshutdown
+
+gprogram autoclicker
+
+# dmenu run but in terminal emulator st
+# only supported terminal apps (less to search through)
+gprogram instantterm
+
+gprogram instantswitch
+gprogram instantnotify
+
+# for that extra kick when doingg a typpo
+gprogram sll
+
+# adds permanent global environment variable
+addenv() {
+    [ -e /etc/environment ] || touch /etc/environment
+    if [ "$1" = "-f" ]; then
+        local FORCE="true"
+        shift 1
+    fi
+
+    if grep -q "$1=" /etc/environment; then
+        if [ -z "$FORCE" ]; then
+            echo "key already existing"
+            return 1
+        else
+            sed -i "s/$1=.*/$1=$2/g" /etc/environment
+        fi
+    else
+        echo "$1=$2" >>/etc/environment
+    fi
+}
+
+addenv -f "QT_QPA_PLATFORMTHEME" "qt5ct"
+command -v nvim &>/dev/null && addenv -f "EDITOR" "$(which nvim)"
+
+# needed for instantLOCK
+if grep -q 'nobody' </etc/groups || grep -q 'nobody' </etc/group; then
+    echo "nobody workaround not required"
+else
+    sudo groupadd nobody
+fi
+
+# fix java gui appearing empty on instantWM
+if ! grep -q 'instantwm' </etc/profile; then
+    echo "fixing java windows for instantwm in /etc/profile"
+    echo '# fix instantwm java windows' >>/etc/profile
+    echo 'export _JAVA_AWT_WM_NONREPARENTING=1' >>/etc/profile
+else
+    echo "java workaround already applied"
+fi
+
+if [ -e /etc/lightdm/lightdm.conf ]; then
+    sudo sed -i 's/^user-session=.*/user-session=instantwm/g' /etc/lightdm/lightdm.conf
+fi
+
+mkdir /tmp/instantinstall
+cd /tmp/instantinstall
+
+# session for lightdm
+wget -q $RAW/paperbenni/suckless/master/instantwm.desktop
+sudo mv instantwm.desktop /usr/share/xsessions/
+
+# laptop specific stuff
+if acpi | grep -q '[0-9]%'; then
+
+    # 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
+
+        # three and four finger swipes on laptop
+        if ! command -v libinput-gestures &>/dev/null; then
+            git clone --depth=1 https://github.com/bulletmark/libinput-gestures.git
+            cd libinput-gestures
+            sudo make install
+            cd ..
+            rm -rf libinput-gestures
+        fi
+    fi
+else
+    echo "system is on a desktop"
+fi
+
+gclone() {
+    echo "cloning $1"
+    gitclone $@ &>/dev/null
+}
+
+iclone() {
+    echo "cloning $1"
+    gitclone instantOS/$@ &>/dev/null
+}
+
+rm -rf /tmp/instantos &>/dev/null
+mkdir /tmp/instantos
+cd /tmp/instantos
+
+iclone instantWM
+iclone instantMENU
+gclone slock
+
+for FOLDER in ./*; do
+    if ! [ -d "$FOLDER" ]; then
+        echo "skipping $FOLDER"
+        continue
+    fi
+    pushd "$FOLDER"
+    if ! [ -e build.sh ]; then
+        rm config.h
+        make &>/dev/null
+        sudo make install &>/dev/null
+    else
+        chmod +x ./build.sh
+        ./build.sh "$THEME" &>/dev/null
+    fi
+    popd
+done
+
+cd /tmp
+rm -rf instantos
\ No newline at end of file
diff --git a/userinstall.sh b/userinstall.sh
new file mode 100755 (executable)
index 0000000..0b07dd1
--- /dev/null
@@ -0,0 +1,69 @@
+#!/usr/bin/env bash
+
+#############################################
+## installs all instantOS tools            ##
+#############################################
+
+echo "installing instantOS tools"
+
+RAW="https://raw.githubusercontent.com"
+source <(curl -s $RAW/paperbenni/bash/master/import.sh)
+pb install
+pb git
+
+LINK="$RAW/paperbenni/suckless/master"
+
+curl "$LINK/termprograms.txt" >~/.cache/termprograms.txt
+
+if ! [ ~/.local/share/fonts/symbola.ttf ]; then
+    mkdir -p ~/.local/share/fonts
+    cd ~/.local/share/fonts
+    echo "installing symbola font"
+    wget -q "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
+else
+    curl -s "$RAW/paperbenni/suckless/master/monitor.sh" | bash
+fi
+
+cd
+
+# auto start script with instantWM
+ls .instantos &>/dev/null || mkdir .instantos
+curl $LINK/autostart.sh >.instantos/autostart.sh
+chmod +x .instantos/autostart.sh
+
+cd /tmp
+# 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 &>/dev/null
+    cd dragon
+    make
+    make install
+    cd ..
+    rm -rf dragon
+fi
+
+cd
+mkdir -p paperbenni/notifications &>/dev/null
+
+# gets executed by dunst on notification
+curl "$RAW/paperbenni/suckless/master/programs/dunsttrigger" >~/paperbenni/notifications/dunsttrigger
+chmod +x ~/paperbenni/notifications/dunsttrigger
+wget -O ~/paperbenni/notifications/notification.ogg "https://notificationsounds.com/notification-sounds/me-too-603/download/ogg"
+
+cd
+mkdir instantos/wallpapers
+curl -s "$RAW/instantOS/instantWALLPAPER/master/wall.sh" >intantos/wallpapers/wall.sh
+chmod +x intantos/wallpapers/wall.sh
+
+# set instantwm as default for lightdm
+echo '[Desktop]' >.dmrc
+echo 'Session=instantwm' >>.dmrc