mirror of
https://github.com/brain-hackers/brain-config.git
synced 2024-12-22 20:20:06 +09:00
Add new is_installed function; fix bug preventing VNC server from being stopped
This commit is contained in:
parent
b872f11509
commit
7535cdd94e
16
raspi-config
16
raspi-config
@ -81,6 +81,14 @@ is_fkms() {
|
||||
fi
|
||||
}
|
||||
|
||||
is_installed() {
|
||||
if [ "$(dpkg -l "$1" 2> /dev/null | tail -n 1 | cut -d ' ' -f 1)" != "ii" ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
deb_ver () {
|
||||
ver=`cat /etc/debian_version | cut -d . -f 1`
|
||||
echo $ver
|
||||
@ -803,7 +811,7 @@ do_vnc() {
|
||||
RET=$1
|
||||
fi
|
||||
if [ $RET -eq 0 ]; then
|
||||
if [ -d /usr/share/doc/realvnc-vnc-server ] || apt-get install realvnc-vnc-server; then
|
||||
if is_installed realvnc-vnc-server || apt install -y realvnc-vnc-server; then
|
||||
systemctl enable vncserver-x11-serviced.service &&
|
||||
systemctl start vncserver-x11-serviced.service &&
|
||||
STATUS=enabled
|
||||
@ -811,10 +819,8 @@ do_vnc() {
|
||||
return 1
|
||||
fi
|
||||
elif [ $RET -eq 1 ]; then
|
||||
if [ ! -d /usr/share/doc/realvnc-vnc-server ] ; then
|
||||
systemctl disable vncserver-x11-serviced.service
|
||||
systemctl stop vncserver-x11-serviced.service
|
||||
fi
|
||||
systemctl disable vncserver-x11-serviced.service
|
||||
systemctl stop vncserver-x11-serviced.service
|
||||
STATUS=disabled
|
||||
else
|
||||
return $RET
|
||||
|
Loading…
Reference in New Issue
Block a user