#!/bin/bash
-######################################################
-## installs all system wide programs for instantOS ##
-######################################################
-source <(curl -Ls https://git.io/JerLG)
-pb install
-pb git
-
-if ! [ $(whoami) = "root" ]; then
+####################################################
+## installs all system wide tweaks for instantOS ##
+####################################################
+
+if ! [ "$(whoami)" = "root" ]; then
echo "please run this as root"
exit 1
fi
groupadd "$1" &>/dev/null
for USER in $(ls /home/ | grep -v '+'); do
if ! sudo su "$USER" -c groups | grep -Eq " $1|$1 "; then
- sudo gpasswd -a $USER $1
+ sudo gpasswd -a "$USER" "$1"
fi
done
}
RAW="https://raw.githubusercontent.com"
-# fetches and installs program from this repo
-gprogram() {
- echo "installing $1"
- curl -s "$RAW/instantos/instantos/master/programs/$1" | sudo tee /usr/local/bin/$1 &>/dev/null
- sudo chmod +x /usr/local/bin/"$1"
-}
-
-curl -s "https://raw.githubusercontent.com/instantOS/instantASSIST/master/install.sh" | bash
-
-# x session wrapper
-gprogram startinstantos
-# shutdown popup that breaks restart loop
-gprogram instantshutdown
-
-gprogram autoclicker
-
-# instantmenu 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
-
-# fallback wallpaper if others fail to load
-if ! [ -e /opt/instantos/wallpapers/default.png ]; then
- mkdir /opt/instantos/wallpapers
- wget -qO /opt/instantos/wallpapers/default.png \
- "https://raw.githubusercontent.com/instantOS/instantLOGO/master/wallpaper/defaultwall.png"
-fi
-
# adds permanent global environment variable
addenv() {
[ -e /etc/environment ] || touch /etc/environment
addenv -f "QT_QPA_PLATFORMTHEME" "qt5ct"
addenv -f "PAGER" "less"
-command -v nvim &>/dev/null && addenv -f "EDITOR" "$(which nvim)"
+addenv -f "EDITOR" "$(which nvim)"
+addenv -f "XDG_MENU_PREFIX" "gnome-"
# needed for instantLOCK
-if grep -q 'nobody' </etc/groups || grep -q 'nobody' </etc/group; then
+if grep -q 'nobody' </etc/groups &>/dev/null || grep -q 'nobody' </etc/group &>/dev/null; then
echo "nobody workaround not required"
else
sudo groupadd nobody
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
- sudo sed -i '# user-session = Session to load for users/user-session=instantwm/g'
+# color scheme for tty
+if ! grep -q '# nord colors' /etc/profile; then
+ echo "applying color scheme"
+
+ echo '# nord colors' >>/etc/profile
+ echo 'if [ "$TERM" = "linux" ]; then' >>/etc/profile
+
+ cat <<EOT >>/etc/profile
+ echo -en "\e]P0383c4a" #black
+ echo -en "\e]P8404552" #darkgrey
+ echo -en "\e]P19A4138" #darkred
+ echo -en "\e]P9E7766B" #red
+ echo -en "\e]P24BEC90" #darkgreen
+ echo -en "\e]PA3CBF75" #green
+ echo -en "\e]P3CFCD63" #brown
+ echo -en "\e]PBFFD75F" #yellow
+ echo -en "\e]P45294e2" #darkblue
+ echo -en "\e]PC579CEF" #blue
+ echo -en "\e]P5CE50DD" #darkmagenta
+ echo -en "\e]PDE7766B" #magenta
+ echo -en "\e]P66BE5E7" #darkcyan
+ echo -en "\e]PE90FDFF" #cyan
+ echo -en "\e]P7CCCCCC" #lightgrey
+ echo -en "\e]PFFFFFFF" #white
+ clear #for background artifacting
+fi
+
+EOT
+
fi
-mkdir /tmp/instantinstall
-cd /tmp/instantinstall
-
-# session for lightdm
-wget -q $RAW/instantos/instantos/master/instantwm.desktop
-sudo mv instantwm.desktop /usr/share/xsessions/
-sudo chmod 644 /usr/share/xsessions/instantwm.desktop
-
-# laptop specific stuff
-if acpi | grep -q '[0-9]%' &>/dev/null; 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
+# /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
+ else
+ 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
-else
- echo "system is on a desktop"
fi
-echo "the theme is $THEME"
-
-iclone() {
- echo "cloning $1"
- gitclone instantOS/$1 &>/dev/null
- if [ -e "$1"/build.sh ]; then
- cd "$1"
- ./build.sh "$THEME"
- cd ..
- rm -rf "$1"
- cd /tmp/instantosbin
+# 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
+ echo "live session builder detected"
+else
+ if [ -e /etc/lightdm/lightdm.conf ] && ! grep -q 'instantwm' /etc/lightdm/lightdm.conf; then
+ sudo sed -i 's/^user-session=.*/user-session=instantwm/g' /etc/lightdm/lightdm.conf
+ sudo sed -i '# user-session = Session to load for users/user-session=instantwm/g' /etc/lightdm/lightdm.conf
fi
-}
-rm -rf /tmp/instantosbin &>/dev/null
-mkdir /tmp/instantosbin
-cd /tmp/instantosbin
+ # check if computer is a potato
+ 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.
+
+ if grep -iq 'Ryzen' /proc/cpuinfo || lshw -C display | grep -q 'nvidia' || [ "$MEMAMOUNT" -gt 3500 ]; then
+ echo "classifying pc as not a potato"
+ else
+ echo "looks like your pc is a potato"
+ mkdir -p /opt/instantos
+ echo "true" >/opt/instantos/potato
+ fi
-iclone instantWM
-iclone instantMENU
-iclone instantLOCK
+ # fix brightness permissions
+ bash /usr/share/instantassist/data/backlight.sh
+ # set up postinstall trigger
+
+ mkdir -p /opt/instantos
+ touch /opt/instantos/installtrigger
+fi
-cd /tmp
-rm -rf instantos
+# indicator file
+touch /opt/instantos/rootinstall