useful_scripts/install_ubuntu.sh

119 lines
3.9 KiB
Bash
Raw Normal View History

2024-03-02 13:22:30 +00:00
#!/bin/bash
2024-03-02 11:16:38 +00:00
# ubuntu hangs if network interface is not optional
2024-03-02 13:44:33 +00:00
if ! sudo grep -r optional /etc/netplan
then
sudo sed -i '/dhcp4/a\ optional: yes' /etc/netplan/00-installer-config-wifi.yaml
sudo sed -i '/dhcp4/a\ optional: yes' /etc/netplan/00-installer-config.yaml
fi
2024-03-02 10:14:43 +00:00
# Add firefox repo
2024-03-03 14:01:00 +00:00
sudo bash -c 'echo "deb [trusted=yes] https://packages.mozilla.org/apt mozilla main" > /etc/apt/sources.list.d/mozilla.list'
2024-03-02 10:14:43 +00:00
# By default ubuntu installs firefox from snap, so I want to disable it
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' | sudo tee /etc/apt/preferences.d/mozilla
# install packages I need
sudo apt update
sudo apt install -y nala
sudo nala install -y \
2024-03-02 13:44:33 +00:00
xorg `# for graphics` \
make `# for compiling gui` \
gcc `# for compiling gui` \
libx11-dev `# for compiling dwm` \
libxft-dev `# for compiling dwm` \
libxinerama-dev `# for compiling dwm` \
libharfbuzz-dev `# for compiling st` \
suckless-tools `# for dmenu` \
ncdu `# for disk usage analysys` \
brightnessctl `# for keyboard backlight` \
xcompmgr `# for st opacity` \
xwallpaper `# for background` \
ubuntu-wallpapers-jammy `# backgrounds` \
2024-03-03 14:01:00 +00:00
pulseaudio `# for sound` \
alsa-base `# for sound` \
2024-03-03 15:21:42 +00:00
pavucontrol `# for audio control` \
pasystray `# for audio control` \
iputils-ping `# ping etc.` \
2024-03-02 13:44:33 +00:00
xfe `# classic file manager` \
2024-03-02 14:40:47 +00:00
surf `# suckless lightweight browser` \
2024-03-03 14:01:00 +00:00
micro `# console editor` \
neovim `# console editor` \
2024-03-02 15:44:53 +00:00
psmisc `# pstree etc.` \
2024-03-02 10:14:43 +00:00
slack \
2024-03-02 13:22:30 +00:00
firefox \
2024-03-03 14:01:00 +00:00
python3 \
2024-03-03 18:02:53 +00:00
python3-venv \
libnvidia-compute-545 `# for mpv + nvidia` \
nvidia-driver-545 `# nvidia driver` \
nvidia-cuda-toolkit `# cuda driver`
2024-03-02 10:14:43 +00:00
2024-03-02 15:44:53 +00:00
# install telegram
2024-03-03 14:01:00 +00:00
if [ ! -d /opt/Telegram ]
then
if [ ! -f telegram.tar.xz ]
then
curl -L https://telegram.org/dl/desktop/linux -o telegram.tar.xz
fi
tar -xf telegram.tar.xz
rm -f telegram.tar.xz
sudo mv Telegram /opt/
fi
2024-03-02 10:14:43 +00:00
# remove snap cause I hate it
sudo systemctl disable --now snapd
2024-03-02 11:16:38 +00:00
sudo apt purge snapd -y
2024-03-02 13:30:43 +00:00
# remove autoinstalled stterm
sudo apt remove stterm -y
2024-03-02 11:16:38 +00:00
2024-03-02 10:14:43 +00:00
2024-03-02 11:16:38 +00:00
if [ ! -d ~/gui ]
then
git clone https://git.digitalstudium.com/digitalstudium/ubuntu-gui ~/gui
fi
2024-03-02 10:14:43 +00:00
2024-03-02 13:22:30 +00:00
for tool in dwm st sent
2024-03-02 13:44:33 +00:00
do
2024-03-02 13:22:30 +00:00
# compiling dwm
if ! command -v $tool &> /dev/null
then
cd ~/gui/$tool
sudo make install clean
cd -
fi
done
2024-03-02 10:14:43 +00:00
2024-03-02 13:22:30 +00:00
echo dwm > ~/.xinitrc # for starting dwm when startx
2024-03-02 10:14:43 +00:00
2024-03-02 13:22:30 +00:00
for tool in create_systemd_service.py create_systemd_timer.py set_brightness.sh update_gui.sh
2024-03-02 13:44:33 +00:00
do
2024-03-02 13:22:30 +00:00
if ! command -v $tool &> /dev/null
then
sudo cp $tool /usr/local/bin
fi
done
git config --global user.name "Digital Studium"
git config --global user.email "digitalstudium001@gmail.com"
sudo create_systemd_service.py gui-updater /usr/local/bin/update_gui.sh
sudo create_systemd_timer.py gui-updater '*-*-* *:*:*'
if [ ! -d ~/.dwm ]
2024-03-02 10:14:43 +00:00
then
2024-03-02 13:22:30 +00:00
mkdir $HOME/.dwm
fi
2024-03-02 14:40:47 +00:00
echo "xhost +local:" > $HOME/.dwm/autostart.sh # give permissions to display
2024-03-02 13:50:35 +00:00
echo "xcompmgr &" >> $HOME/.dwm/autostart.sh # for st opacity
echo "xwallpaper --stretch /usr/share/backgrounds/Blue_flower_by_Elena_Stravoravdi.jpg" >> $HOME/.dwm/autostart.sh # background
2024-03-02 14:40:47 +00:00
echo "firefox &" >> $HOME/.dwm/autostart.sh
2024-03-02 15:44:53 +00:00
echo "Telegram &" >> $HOME/.dwm/autostart.sh
2024-03-02 13:22:30 +00:00
echo "st &" >> $HOME/.dwm/autostart.sh
2024-03-03 15:21:42 +00:00
echo "pasystray &" >> $HOME/.dwm/autostart.sh
2024-03-02 13:22:30 +00:00
chmod +x $HOME/.dwm/autostart.sh
2024-03-02 14:56:52 +00:00
sudo timedatectl set-timezone Europe/Moscow
2024-03-02 15:44:53 +00:00
sudo bash -c "echo 'PATH=\$(find /opt/ -executable -type f | grep -v \.so | xargs dirname | uniq | paste -s -d : | xargs -I _ echo \$PATH:_)' > /etc/profile.d/opt.sh"