-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·148 lines (133 loc) · 3.12 KB
/
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
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
#!/bin/bash
# Usage:
# bash <(curl -s "https://raw.githubusercontent.com/MarcoWel/bashutils/master/install.sh") -h "MYHOST" -u "MYUSER"
echo "INSTALLING BASHUTILS"
echo
# Set defaults
host=
domain=
user=
password=
resolution="1920x1080"
bitdepth="16"
logfile="$HOME/rdplog.txt"
# Read commandline flags:
# -h HOST
# -d DOMAIN
# -u USER
# -p PASSWORD
# -l LOGFILE
while getopts h:d:u:p:l: flag
do
case "${flag}" in
h) host=${OPTARG};;
d) domain=${OPTARG};;
u) user=${OPTARG};;
p) password=${OPTARG};;
l) logfile=${OPTARG};;
esac
done
echo "Domain: $domain"
echo "Host: $host"
echo "User: $user"
if [[ -d "$HOME/bashutils" ]]
then
echo
echo "Removing old bashutils..."
rm -rf "$HOME/bashutils"
fi
echo
echo "Downloading repo..."
echo
git clone "https://github.com/MarcoWel/bashutils.git" "$HOME/bashutils"
#curl -s "https://raw.githubusercontent.com/MarcoWel/bashutils/master/rdp.sh" -o "$HOME/bashutils/rdp.sh"
#chmod u+x "$HOME/bashutils/rdp.sh"
echo
echo "Creating rdp.env file..."
cat <<EOF > "$HOME/rdp.env"
host=$host
domain=$domain
user=$user
password=$password
resolution=$resolution
bitdepth=$bitdepth
logfile=$logfile
EOF
echo
echo "Creating desktop shortcuts..."
cat <<EOF > "$HOME/Desktop/Connect.desktop"
[Desktop Entry]
Type=Application
Name=Connect
Type=Application
Exec=bash bashutils/rdp.sh
Terminal=true
Icon=system-users-symbolic
EOF
chmod u+x "$HOME/Desktop/Connect.desktop"
cat <<EOF > "$HOME/Desktop/Connect with User.desktop"
[Desktop Entry]
Type=Application
Name=Connect with User
Type=Application
Exec=bash bashutils/rdp.sh -u ""
Terminal=true
Icon=system-users-symbolic
EOF
chmod u+x "$HOME/Desktop/Connect with User.desktop"
echo
echo "Installing packages..."
echo
sudo apt install raspberrypi-ui-mods freerdp2-x11 moreutils
echo
echo
echo "*** Bashutils installation is complete! ***"
echo
read -p "Would you like to perform a system update as well? y/N " res
if [[ $res == "y" ]]
then
echo
read -p ">> Remove unneccessary packages to free disk space? y/N " res
if [[ $res == "y" ]]
then
echo "Removing packages..."
echo
$HOME/bashutils/cleanpi.sh
echo
fi
echo
echo "Current kernel version:"
uname -a
echo
read -p ">> Perform a kernel update now (rpi-update)? y/N " res
if [[ $res == "y" ]]
then
echo "Performing kernel update..."
echo
sudo rpi-update
echo
uname -a
fi
echo
echo "Current OS version:"
lsb_release -a
echo
echo "Note: To upgrade to a specific OS release:"
echo " - Check /etc/apt/sources.list and files in /etc/apt/sources.list.d/"
echo " - Open in editor (e.g. sudo nano) and replace OS version (e.g. strech with bullseye)"
echo
read -p ">> Perform a system update now (apt update && apt full-upgrade)? y/N " res
if [[ $res == "y" ]]
then
echo "Performing system update..."
echo
sudo apt update
sudo apt -y full-upgrade
sudo apt -y autoremove
sudo apt -y autoclean
echo
lsb_release -a
fi
echo
echo "Done!"
fi