Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
5f52776a
Commit
5f52776a
authored
Sep 22, 2017
by
ThomasKaiser
Browse files
Provide a saner way to get installation status of certain packages
parent
4ba72249
Changes
1
Show whitespace changes
Inline
Side-by-side
softy
View file @
5f52776a
...
...
@@ -6,6 +6,8 @@
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
export
PATH
=/
usr
/
local
/
sbin
:/
usr
/
local
/
bin
:/
usr
/
sbin
:/
usr
/
bin
:/
sbin
:/
bin
function
check_status
{
#------------------------------------------------------------------------------------------------------------------------------------------
...
...
@@ -50,10 +52,13 @@ function choose_webserver
#------------------------------------------------------------------------------------------------------------------------------------------
# Target web server selection
#------------------------------------------------------------------------------------------------------------------------------------------
if
[
-
f
/
etc
/
default
/
openmediavault
];
then
check_if_installed
openmediavault
case
$
?
in
0
)
# OMV installed, prevent switching from nginx to apache which would trash OMV installation
server
=
"nginx"
else
;;
*
)
dialog
--
title
"Choose a webserver"
--
backtitle
"
$backtitle
"
--
yes
-
label
"Apache"
--
no
-
label
"Nginx"
\
--
yesno
"
\n
Choose a web server which you are familiar with. They both work almost the same."
8
70
response
=
$
?
...
...
@@ -62,7 +67,8 @@ else
1
)
server
=
"nginx"
;;
255
)
exit
;;
esac
fi
;;
esac
}
...
...
@@ -932,6 +938,18 @@ echo "PHPmyadmin: http://$serverIP:8081/phpmyadmin"
}
check_if_installed (){
#------------------------------------------------------------------------------------------------------------------------------------------
# check dpkg status of $1 -- currently only 'not installed at all' case catched
#------------------------------------------------------------------------------------------------------------------------------------------
local DPKG_Status="$(dpkg -s "$1" 2>/dev/null | awk -F": " '/^Status/ {print $2}')"
if [ "X${DPKG_Status}" = "X" ]; then
return 1
else
return 0
fi
}
#------------------------------------------------------------------------------------------------------------------------------------------
# Main choices
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment