forked from scawp/Steam-Deck.Mount-External-Drive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
curl_install.sh
executable file
·99 lines (76 loc) · 3.56 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
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
#!/bin/bash
#Steam Deck Mount External Drive by scawp
#License: DBAD: https://github.com/scawp/Steam-Deck.Mount-External-Drive/blob/main/LICENSE.md
#Source: https://github.com/scawp/Steam-Deck.Mount-External-Drive
# Use at own Risk!
#curl -sSL https://raw.githubusercontent.com/scawp/Steam-Deck.Mount-External-Drive/main/curl_install.sh | bash
#stop running script if anything returns an error (non-zero exit )
set -e
repo_url="https://raw.githubusercontent.com/Daripa/Steam-Deck.Mount-External-Drive/main"
repo_lib_dir="$repo_url/lib"
tmp_dir="/tmp/scawp.SDMED.install"
rules_install_dir="/etc/udev/rules.d"
service_install_dir="/etc/systemd/system"
script_install_dir="/home/gamer/.local/share/scawp/SDMED"
device_name="$(uname --nodename)"
user="$(id -u gamer)"
if [ "$device_name" != "chimeraos" ] || [ "$user" != "1000" ]; then
zenity --question --width=400 \
--text="This code has been written specifically for the Steam Deck with user Deck \
\nIt appears you are running on a different system/non-standard configuration. \
\nAre you sure you want to continue?"
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 1;
fi
fi
function install_automount () {
zenity --question --width=400 \
--text="Read $repo_url/README.md before proceeding. \
\nDo you want to install the Auto-Mount 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/automount.sh" "$repo_url/automount.sh"
curl -o "$tmp_dir/[email protected]" "$repo_lib_dir/[email protected]"
curl -o "$tmp_dir/99-external-drive-mount.rules" "$repo_lib_dir/99-external-drive-mount.rules"
echo "Making script folder $script_install_dir"
mkdir -p "$script_install_dir"
echo "Copying $tmp_dir/automount.sh to $script_install_dir/automount.sh"
sudo cp "$tmp_dir/automount.sh" "$script_install_dir/automount.sh"
echo "Adding Execute and Removing Write Permissions"
sudo chmod 555 $script_install_dir/automount.sh
echo "Copying $tmp_dir/99-external-drive-mount.rules to $rules_install_dir/99-external-drive-mount.rules"
sudo cp "$tmp_dir/99-external-drive-mount.rules" "$rules_install_dir/99-external-drive-mount.rules"
echo "Copying $tmp_dir/[email protected] to $service_install_dir/[email protected]"
sudo cp "$tmp_dir/[email protected]" "$service_install_dir/[email protected]"
echo "Reloading Services"
sudo udevadm control --reload
sudo systemctl daemon-reload
}
function install_zmount () {
zenity --question --width=400 \
--text="Would you like to add \"zMount.sh\" \
\n(a tool to manually mount drives) to your Steam Library?"
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 "Downloading Required Files"
curl -o "$tmp_dir/zMount.sh" "$repo_url/zMount.sh"
echo "Copying $tmp_dir/zMount.sh to $script_install_dir/zMount.sh"
sudo cp "$tmp_dir/zMount.sh" "$script_install_dir/zMount.sh"
echo "Adding Execute and Removing Write Permissions"
sudo chmod 555 "$script_install_dir/zMount.sh"
steamos-add-to-steam "$script_install_dir/zMount.sh"
}
install_automount
install_zmount
echo "Done."