Skip to content

Commit c8af39f

Browse files
author
ron.record
committed
Further unattended install improvements
1 parent 4851d65 commit c8af39f

File tree

3 files changed

+24
-106
lines changed

3 files changed

+24
-106
lines changed

InstallUnattended

Lines changed: 10 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,9 @@ fi
3434
[ "${iamroot}" ] && {
3535
printf "\nThe ${BOLD}Install${NORM} command should be run as a normal user."
3636
printf "\nIt appears it has been invoked with 'root' user privileges.\n\n"
37-
while true
38-
do
39-
read -p "Do you intend to use RoonCommandLine as the 'root' user ? (y/n) " yn
40-
case $yn in
41-
[Yy]* )
42-
break
43-
;;
44-
[Nn]* )
45-
printf "\nRe-run this command as a normal user."
46-
printf "\nExiting.\n\n"
47-
exit 0
48-
;;
49-
* ) echo "Please answer yes or no."
50-
;;
51-
esac
52-
done
37+
printf "\nRe-run this command as a normal user."
38+
printf "\nExiting.\n\n"
39+
exit 0
5340
}
5441

5542
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
@@ -78,29 +65,6 @@ get_available_packages() {
7865
PKG_AVAILABLE=`echo $PKG_AVAILABLE | sed -e "s/^ //"`
7966
}
8067

81-
install_selected() {
82-
for pkg in ${PKG_AVAILABLE}
83-
do
84-
while true
85-
do
86-
read -p "Install ${pkg} ? ('Y'/'N'): " yn
87-
case $yn in
88-
[Yy]*)
89-
PKG_SELECTED="${PKG_SELECTED} $pkg"
90-
break
91-
;;
92-
[Nn]*)
93-
break
94-
;;
95-
* )
96-
echo "Please answer yes or no."
97-
;;
98-
esac
99-
done
100-
done
101-
PKG_SELECTED=`echo $PKG_SELECTED | sed -e "s/^ //"`
102-
}
103-
10468
plat=`uname -s`
10569
if [ "$plat" == "Darwin" ]
10670
then
@@ -122,49 +86,6 @@ else
12286

12387
if [ "${PKG_AVAILABLE}" ]
12488
then
125-
[ "$1" ] && {
126-
# If invoked with -i argument, present a menu of options to select from
127-
if [ "$1" == "-i" ]
128-
then
129-
shift
130-
PKG_NAMES="$*"
131-
[ "${PKG_AVAILABLE}" ] && {
132-
echo "Currently available RoonCommandLine packages:"
133-
echo ""
134-
for avaipkg in ${PKG_AVAILABLE}
135-
do
136-
echo "$avaipkg"
137-
done
138-
echo ""
139-
}
140-
while true
141-
do
142-
PS3="${BOLD}Please enter your desire (numeric or text): ${NORM}"
143-
options=("Install All" "Install Selected" "Quit")
144-
select opt in "${options[@]}"
145-
do
146-
case "$opt,$REPLY" in
147-
"Install All",*|*,"Install All")
148-
PKG_NAMES="${PKG_AVAILABLE}"
149-
break 2
150-
;;
151-
"Install Selected",*|*,"Install Selected")
152-
install_selected
153-
PKG_NAMES="${PKG_SELECTED}"
154-
break 2
155-
;;
156-
"Quit",*|*,"Quit"|"quit",*|*,"quit")
157-
printf "\nExiting\n"
158-
exit 0
159-
;;
160-
esac
161-
done
162-
done
163-
else
164-
PKG_NAMES="$*"
165-
fi
166-
}
167-
16889
[ "${PKG_NAMES}" ] || {
16990
echo "No valid Package names specified. Exiting."
17091
exit 1
@@ -191,7 +112,7 @@ else
191112
then
192113
if [ "${have_apt}" ]
193114
then
194-
sudo -E apt install "${PKG}"
115+
sudo -E apt -y install "${PKG}"
195116
else
196117
if [ "${have_dpkg}" ]
197118
then
@@ -203,7 +124,7 @@ else
203124
else
204125
if [ "${have_yum}" ]
205126
then
206-
sudo -E yum localinstall "${PKG}"
127+
sudo -E yum -y localinstall "${PKG}"
207128
else
208129
if [ "${have_rpm}" ]
209130
then
@@ -215,25 +136,10 @@ else
215136
fi
216137
done
217138
else
218-
while true
219-
do
220-
echo ""
221-
echo "No packages for version ${PKG_VER} are currently available."
222-
echo "Would you like to perform a scripted install on this platform?"
223-
echo ""
224-
read -p "Install ${pkg} ? ('Y'/'N'): " yn
225-
case $yn in
226-
[Yy]*)
227-
./linInstall
228-
break
229-
;;
230-
[Nn]*)
231-
break
232-
;;
233-
*)
234-
echo "Please answer yes or no."
235-
;;
236-
esac
237-
done
139+
echo ""
140+
echo "No packages for version ${PKG_VER} are currently available."
141+
echo "Performing a scripted install on this platform."
142+
echo ""
143+
./linInstall
238144
fi
239145
fi

bin/roon

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2171,7 +2171,19 @@ while getopts A:a:bBc:C:dD:f:F:g:G:hHiImnNOp:T:t:z:l:s:LSr:v:x:X:EuU flag; do
21712171
done
21722172

21732173
# Check if RoonCommandLine has been initialized
2174-
[ -f ${ROONETC}/.initialized ] || ${ROON}/etc/discover
2174+
[ -f ${ROONETC}/.initialized ] || {
2175+
if [ "${comm}" ]; then
2176+
case "${comm}" in
2177+
"discover"* | "init"*)
2178+
;;
2179+
*)
2180+
${ROON}/etc/discover
2181+
;;
2182+
esac
2183+
else
2184+
${ROON}/etc/discover
2185+
fi
2186+
}
21752187

21762188
[ "${inst_roon_gui}" ] && {
21772189
[ -x ${ROON}/etc/install-roon-gui ] && ${ROON}/etc/install-roon-gui

etc/postinstall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ if [ "${PYTHONUSERBASE}" ]; then
236236
fi
237237
. ${ROONCONF}
238238

239-
RVER=$(${PYTHON} -m pip show roonapi | grep Version | awk -F ':' ' { print $2 } ')
239+
RVER=$(${PYTHON} -m pip show roonapi 2>/dev/null | grep Version | awk -F ':' ' { print $2 } ')
240240
# Remove leading and trailing spaces in RVER
241241
RVER="$(echo -e "${RVER}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
242242
# Only patch Roonapi version 0.0.38 and earlier

0 commit comments

Comments
 (0)