3 ####################################################
4 ## installs all system wide tweaks for instantOS ##
5 ####################################################
7 if ! [ "$(whoami)" = "root" ]; then
8 echo "please run this as root"
12 mkdir -p /opt/instantos
14 # add group and add users to group
16 groupadd "$1" &>/dev/null
17 for USER in $(ls /home/ | grep -v '+'); do
18 if ! sudo su "$USER" -c groups | grep -Eq " $1|$1 "; then
19 sudo gpasswd -a "$USER" "$1"
27 export RAW="https://raw.githubusercontent.com"
29 # adds permanent global environment variable
31 [ -e /etc/environment ] || touch /etc/environment
32 if [ "$1" = "-f" ]; then
37 if grep -q "$1=" /etc/environment; then
38 if [ -z "$FORCE" ]; then
39 echo "key already existing"
42 sed -i "s~$1=.*~$1=$2~g" /etc/environment
45 echo "$1=$2" >>/etc/environment
49 addenv -f "QT_QPA_PLATFORMTHEME" "qt5ct"
50 addenv -f "PAGER" "less"
52 addenv -f "EDITOR" "$(which nvim)"
54 addenv -f "XDG_MENU_PREFIX" "gnome-"
56 # needed for instantLOCK
57 if grep -q 'nobody' </etc/groups &>/dev/null || grep -q 'nobody' </etc/group &>/dev/null; then
58 echo "nobody workaround not required"
63 # fix java gui appearing empty on instantWM
64 if ! grep -q 'instantwm' </etc/profile; then
65 echo "fixing java windows for instantwm in /etc/profile"
66 echo '# fix instantwm java windows' >>/etc/profile
67 echo 'export _JAVA_AWT_WM_NONREPARENTING=1' >>/etc/profile
69 echo "java workaround already applied"
72 # color scheme for tty
73 if ! grep -q '# nord colors' /etc/profile; then
74 echo "applying color scheme"
78 echo 'if [ "$TERM" = "linux" ]; then'
81 cat <<EOT >>/etc/profile
82 echo -en "\e]P0383c4a" #black
83 echo -en "\e]P8404552" #darkgrey
84 echo -en "\e]P19A4138" #darkred
85 echo -en "\e]P9E7766B" #red
86 echo -en "\e]P24BEC90" #darkgreen
87 echo -en "\e]PA3CBF75" #green
88 echo -en "\e]P3CFCD63" #brown
89 echo -en "\e]PBFFD75F" #yellow
90 echo -en "\e]P45294e2" #darkblue
91 echo -en "\e]PC579CEF" #blue
92 echo -en "\e]P5CE50DD" #darkmagenta
93 echo -en "\e]PDE7766B" #magenta
94 echo -en "\e]P66BE5E7" #darkcyan
95 echo -en "\e]PE90FDFF" #cyan
96 echo -en "\e]P7CCCCCC" #lightgrey
97 echo -en "\e]PFFFFFFF" #white
98 clear #for background artifacting
105 # /tmp/topinstall is present if rootinstall is running on postinstall
106 # like on existing installations
107 if ! [ -e /tmp/topinstall ] && command -v plymouth-set-default-theme && ! grep -iq 'manjaro' /etc/os-release; then
108 # install a custom repo
109 if ! grep -q '\[instant\]' /etc/pacman.conf; then
110 echo "restoring repo"
111 /usr/share/instantutils/repo.sh
113 echo "instantOS repo found"
116 # deactivate root password, will be reenabled on postinstall
117 if ! grep -iq manjaro /etc/os-release; then
118 echo "root ALL=(ALL) NOPASSWD:ALL #instantosroot" >>/etc/sudoers
119 echo "" >>/etc/sudoers
122 if ! [ -e /opt/instantos/bootscreen ] && [ -e /opt/instantos/realinstall ] && ! [ -e /opt/instantos/noplymouth ]; then
123 echo "installing boot splash screen"
124 plymouth-set-default-theme instantos
126 if ! grep -q 'instantos boot animation' /etc/default/grub; then
127 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' \
131 if ! grep -q '.*plymouth.* # boot screen' /etc/mkinitcpio.conf; then
132 sed -i '/^HOOKS/aHOOKS+=(plymouth) # boot screen' /etc/mkinitcpio.conf
135 systemctl disable lightdm
136 systemctl enable lightdm-plymouth
141 touch /opt/instantos/bootscreen
145 # tmux doesn't count as console user
146 if ! [ -e /etc/X11/Xwrapper.config ]; then
147 echo "enabling startx"
148 echo 'allowed_users=anybody' >/etc/X11/Xwrapper.config
151 if [ -e /opt/livebuilder ]; then
152 echo "live session builder detected"
154 if [ -e /etc/lightdm/lightdm.conf ] && ! grep -q 'instantwm' /etc/lightdm/lightdm.conf; then
155 sudo sed -i 's/^user-session=.*/user-session=instantwm/g' /etc/lightdm/lightdm.conf
156 sudo sed -i '# user-session = Session to load for users/user-session=instantwm/g' /etc/lightdm/lightdm.conf
159 # check if computer is a potato
160 MEMAMOUNT="$($(which free) -m | grep -vi swap | grep -o '[0-9]*' | sort -n | tail -1)"
162 # computer is not a potato if it has an nvidia card, a ryzen processor or more than 3,5gb of ram.
163 # it can be unpotatoed at any time.
165 if grep -iq 'Ryzen' /proc/cpuinfo || lshw -C display | grep -q 'nvidia' || [ "$MEMAMOUNT" -gt 3500 ]; then
166 echo "classifying pc as not a potato"
168 echo "looks like your pc is a potato"
169 mkdir -p /opt/instantos
170 echo "true" >/opt/instantos/potato
173 # fix brightness permissions
174 bash /usr/share/instantassist/data/backlight.sh
175 # set up postinstall trigger
177 mkdir -p /opt/instantos
178 touch /opt/instantos/installtrigger
182 touch /opt/instantos/rootinstall