-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathinit.sh
158 lines (144 loc) · 6.32 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/bin/bash
clear -x
echo "Initial setup script started!"
cd ~
echo "Checking for updates and installing a few extra recommended packages."
echo "This might take a while, depending on your internet speed."
echo "Grab your charger, and pull up a chair!"
echo "CREDITS:"
echo " https://gbatemp.net/threads/l4t-ubuntu-a-fully-featured-linux-on-your-switch.537301/"
echo " Optional tab on https://gbatemp.net/threads/installing-moonlight-qt-on-l4t-ubuntu.537429/"
echo " https://flatpak.org/setup/"
sleep 10
# obtain the cpu info
get_system
if grep -q bionic /etc/os-release; then
echo
##snap store is not preinstalled on 18.04, nothing to do here
else
description="Do you want to remove the snap store? If unsure, think of it as\
\nbloatware from Canonical\
\nIt's controversial for a few reasons:\
\n - the store is closed source, which is a bit weird for a Linux company...\
\n - programs installed from them are in containers,\
\n which means they won't run as well\
\n - the biggest issue, especially on a weaker device like\
\n the Tegra hardware you're using right now, is that\
\n it automatically updates snap packages whenever it wants\
\n to, with no input from the user - which can obviously\
\n slow anything you're doing at the moment down.\
\nThat being said, if you've already been using this device for a while,\
\nYou may want to keep it for now since you might have installed stuff\
\nusing it. It's recommended by us to switch from snaps to apt, flatpak, and\
\nbuilding from source whenever possible.\
\nSo as you can probably tell, we're extremely biased against\
\nit and would recommend removing it. But the choice is yours:\
\n \n Do you want to remove the Snap Store?"
table=("yes" "no")
userinput_func "$description" "${table[@]}"
if [[ $output == "yes" ]]; then
echo -e "\e[32mRemoving the Snap store...\e[0m"
sudo apt purge snapd unattended-upgrades
else
echo "Decided to keep the Snap store..."
echo "If you ever change your mind, type:"
echo -e "\e[36msudo apt purge snapd unattended-upgrades -y\e[0m"
sleep 5
fi
fi
if grep -q bionic /etc/os-release; then
#bionic's flatpak package is out of date
sudo add-apt-repository ppa:alexlarsson/flatpak -y
#bionic cmake is very old
sudo add-apt-repository ppa:rncbc/libs-bionic -y
if [[ -f "/usr/bin/cmake" ]]; then
#remove manually installed cmake versions (as instructed by theofficialgman) only if apt cmake is found
sudo rm -rf '/usr/local/bin/cmake' '/usr/local/bin/cpack' '/usr/local/bin/ctest'
fi
hash -r
fi
#focal's flatpak package is also out of date (I get LTS is supposed to put stability above all else, but seriously?)
if grep -q focal /etc/os-release; then
sudo add-apt-repository ppa:alexlarsson/flatpak -y
fi
#kinda hard to install flatpaks without flathub
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
if [[ $jetson_model ]]; then
#fix up an issue with running flatpaks by enabling non-privileged user namespaces
sudo chmod u+s /usr/libexec/flatpak-bwrap
fi
#updates whee
sudo apt upgrade -y
#this is an apt package in the Switchroot repo, for documentation join their Discord https://discord.gg/9d66FYg and check https://discord.com/channels/521977609182117891/567232809475768320/858399411955433493
sudo apt install switch-multimedia -y
#install some recommended dependencies - the fonts packages are there to support a lot of symbols and foreign language characters
sudo apt install joycond subversion wget flatpak gnome-software-plugin-flatpak qt5-style-plugins gnutls-bin -y
# fonts-noto-cjk fonts-noto-cjk-extra fonts-migmix fonts-noto-color-emoji
hash -r
#automatically sets QT applications to follow the system theme
grep -qxF 'export QT_QPA_PLATFORMTHEME=gtk2' ~/.profile || echo 'export QT_QPA_PLATFORMTHEME=gtk2' | sudo tee --append ~/.profile
#and now i (attempt to) force it on anyway so that the user doesn't have to reboot to see the effect
#i'm not entirely positive this works, they still might have to reboot or log out and log back in
#oh well
export QT_QPA_PLATFORMTHEME=gtk2
clear -x
description="Do you want to install configurations that will let you use the joycons as a mouse?"
table=("yes" "no")
userinput_func "$description" "${table[@]}"
if [[ $output == "yes" ]]; then
echo "Installing the Joycon Mouse..."
bash -c "$(curl -s https://raw.githubusercontent.com/$repository_username/L4T-Megascript/$repository_branch/scripts/joycon-mouse.sh)"
elif [[ $output == "no" ]]; then
echo "Going to the next option"
fi
clear -x
description="Do you want to add a Application/Program/Game Helper? \
\nThis will assist you in adding program binaries you download to your applications list"
table=("yes" "no")
userinput_func "$description" "${table[@]}"
if [[ $output == "yes" ]]; then
echo "Installing the generic program helper..."
sudo tee /usr/share/applications/generic_helper.desktop <<'EOF'
[Desktop Entry]
Type=Application
Exec=bash -c 'bash <( wget -O - https://raw.githubusercontent.com/cobalt2727/L4T-Megascript/master/assets/generic/generic_program_helper.sh )'
Name=Generic Application Helper
Icon=/usr/share/icons/L4T-Megascript.png
Terminal=hidden
Categories=System
EOF
elif [[ $output == "no" ]]; then
echo "Going to the next option"
fi
clear -x
description="Do you want to build and install SDL2? (Required for many games in the script)"
table=("yes" "no")
userinput_func "$description" "${table[@]}"
if [[ $output == "yes" ]]; then
echo "Building and installing SDL2..."
bash -c "$(curl -s https://raw.githubusercontent.com/$repository_username/L4T-Megascript/$repository_branch/scripts/sdl2_install_helper.sh)"
elif [[ $output == "no" ]]; then
echo "Going to the next option"
fi
clear -x
description="Do you want to build and install htop?\
\n(A useful command line utility for viewing cpu/thread usage and frequency)"
table=("yes" "no")
userinput_func "$description" "${table[@]}"
if [[ $output == "yes" ]]; then
echo "Building and installing htop 3.0.5 (newer than the package included in bionic)..."
cd ~
rm -rf htop
sudo apt remove htop -y
sudo apt install libncursesw*-dev dh-autoreconf -y
git clone https://github.com/htop-dev/htop.git
cd htop
git checkout 3.0.5
./autogen.sh && ./configure && make -j$(nproc)
sudo make install
cd ~
rm -rf htop
elif [[ $output == "no" ]]; then
echo "Going to the next option"
fi
clear -x