-
Notifications
You must be signed in to change notification settings - Fork 18
/
curl_install.sh
executable file
·68 lines (52 loc) · 2.41 KB
/
curl_install.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
#!/bin/bash
#Steam Deck Force-SteamOS-On-Boot by scawp
#License: DBAD: https://github.com/scawp/Steam-Deck.Force-SteamOS-On-Boot/blob/main/LICENSE.md
#Source: https://github.com/scawp/Steam-Deck.Force-SteamOS-On-Boot
# Use at own Risk!
#curl -sSL https://raw.githubusercontent.com/scawp/Steam-Deck.Force-SteamOS-On-Boot/main/curl_install.sh | bash
#stop running script if anything returns an error (non-zero exit )
set -e
repo_url="https://raw.githubusercontent.com/scawp/Steam-Deck.Force-SteamOS-On-Boot/main"
tmp_dir="/tmp/scawp.SDFSOB.install"
service_install_dir="/etc/systemd/system"
zenity --question --width=400 \
--text="Read $repo_url/README.md before proceeding. \
\nDo you want to install the Force-SteamOS-On-Boot service?"
if [ "$?" != 0 ]; then
#NOTE: This code will never be reached due to "set -e", the system will already exit for us but just incase keep this
echo "bye then! xxx"
exit 0;
fi
echo "Making tmp folder $tmp_dir"
mkdir -p "$tmp_dir"
echo "Downloading Required Files"
curl -o "$tmp_dir/force-steamos-on-next-boot.service" "$repo_url/force-steamos-on-next-boot.service"
set +e
zenity --question --width=400 \
--text="Configuration Type:" \
--cancel-label="Auto (SteamOS)" \
--ok-label="Manual"
if [ "$?" = 0 ]; then
IFS=$'[\t|\n]';
selected_boot=$(zenity --list --title="Select Default Boot Devive" \
--width=400 --height=400 --print-column=2 --separator="\t" \
--ok-label "Save" --cancel-label="Auto (SteamOS)" \
--radiolist --column="check" --column="Boot No." --column="Name" \
$(efibootmgr | grep -Po "Boot[0-9].*\t" | sed -e "s/*/\t/" -e "s/^/FALSE\t/"))
unset IFS;
if [ "$?" = 0 ] && [ "$selected_boot" != "" ]; then
replace="(efibootmgr | grep BootCurrent | sed -e 's/BootCurrent://')"
sed -i "s&\$$replace&$(echo $selected_boot | sed -e "s/Boot//")&g" "$tmp_dir/force-steamos-on-next-boot.service"
fi
fi
echo "Copying $tmp_dir/force-steamos-on-next-boot.service to $service_install_dir/force-steamos-on-next-boot.service"
sudo cp "$tmp_dir/force-steamos-on-next-boot.service" "$service_install_dir/force-steamos-on-next-boot.service"
echo "Starting Service"
sudo systemctl enable force-steamos-on-next-boot.service
sudo systemctl start force-steamos-on-next-boot.service
if [ "$selected_boot" != "" ]; then
sudo efibootmgr -n$(echo $selected_boot | sed -e "s/Boot//")
else
sudo efibootmgr -n$(efibootmgr | grep BootCurrent | sed -e 's/BootCurrent://')
fi
echo "Done."