OSDN Git Service

remove old file
[instantos/instantOS.git] / rootinstall.sh
index b57fa20..168d1b4 100755 (executable)
@@ -1,10 +1,10 @@
 #!/bin/bash
 
-######################################################
-## installs all system wide programs for instantOS  ##
-######################################################
+####################################################
+## installs all system wide tweaks for instantOS  ##
+####################################################
 
-if ! [ $(whoami) = "root" ]; then
+if ! [ "$(whoami)" = "root" ]; then
     echo "please run this as root"
     exit 1
 fi
@@ -98,7 +98,9 @@ EOT
 
 fi
 
-if ! [ -e /tmp/topinstall ]; then
+# /tmp/topinstall is present if rootinstall is running on postinstall
+# like on existing installations
+if ! [ -e /tmp/topinstall ] && command -v plymouth-set-default-theme && ! grep -iq 'manjaro' /etc/os-release; then
     # install a custom repo
     if ! grep -q '\[instant\]' /etc/pacman.conf; then
         /usr/share/instantutils/repo.sh
@@ -106,10 +108,39 @@ if ! [ -e /tmp/topinstall ]; then
         echo "instantOS repo found"
     fi
 
+    # deactivate root password, will be reenabled on postinstall
     if ! grep -iq manjaro /etc/os-release; then
         echo "root ALL=(ALL) NOPASSWD:ALL #instantosroot" >>/etc/sudoers
         echo "" >>/etc/sudoers
     fi
+
+    if ! [ -e /opt/instantos/bootscreen ] && [ -e /opt/instantos/realinstall ] && ! [ -e /opt/instantos/noplymouth ]; then
+        echo "installing boot splash screen"
+        plymouth-set-default-theme instantos
+
+        if ! grep -q 'instantos boot animation' /etc/default/grub; then
+            sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT="/aGRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT quiet splash loglevel=3 rd.udev.log_priority=3 vt.global_cursor_default=0" # instantos boot animation' \
+                /etc/default/grub
+        fi
+
+        if ! grep -q '.*plymouth.* # boot screen' /etc/mkinitcpio.conf; then
+            sed -i '/^HOOKS/aHOOKS+=(plymouth) # boot screen' /etc/mkinitcpio.conf
+        fi
+
+        systemctl disable lightdm
+        systemctl enable lightdm-plymouth
+
+        /etc/mkinitcpio.conf
+        update-grub
+        mkinitcpio -P
+        touch /opt/instantos/bootscreen
+    fi
+fi
+
+# tmux doesn't count as console user
+if ! [ -e /etc/X11/Xwrapper.config ]; then
+    echo "enabling startx"
+    echo 'allowed_users=anybody' >/etc/X11/Xwrapper.config
 fi
 
 if [ -e /opt/livebuilder ]; then
@@ -121,7 +152,7 @@ else
     fi
 
     # check if computer is a potato
-    MEMAMOUNT="$(free -m | grep -vi swap | grep -o '[0-9]*' | sort -n | tail -1)"
+    MEMAMOUNT="$($(which free) -m | grep -vi swap | grep -o '[0-9]*' | sort -n | tail -1)"
 
     # computer is not a potato if it has an nvidia card, a ryzen processor or more than 3,5gb of ram.
     # it can be unpotatoed at any time.
@@ -135,9 +166,12 @@ else
     fi
 
     # fix brightness permissions
-    bash /opt/instantos/menus/data/backlight.sh
+    bash /usr/share/instantassist/data/backlight.sh
     # set up postinstall trigger
 
     mkdir -p /opt/instantos
     touch /opt/instantos/installtrigger
 fi
+
+# indicator file
+touch /opt/instantos/rootinstall