1
0
forked from mir/linux-vm-tools

removed useless cat and cleaned if statemants up

Calling bash is no longer needed.
Also grep can search on files on its own.
The return status of grep is usable with if and avoids calling
test (or [ for that matter ).
This commit is contained in:
Björn Bidar 2018-03-02 10:15:13 +01:00
parent 5ba1db8391
commit a04a8a9523

View File

@ -18,7 +18,6 @@ fi
apt update && apt upgrade -y
if [ -f /var/run/reboot-required ]; then
echo "A reboot is required in order to proceed with the install." >&2
echo "Please reboot and re-run this script to finish the install." >&2
@ -57,23 +56,21 @@ rmmod vsock
modprobe hv_sock
# Blacklist the vmw module
cat /etc/modprobe.d/blacklist.conf | grep vmw_vsock_vmci_transport --quiet
if [ "$?" == "1" ]; then
bash -c 'echo "blacklist vmw_vsock_vmci_transport" >> /etc/modprobe.d/blacklist.conf <<EOF
EOF'
if grep vmw_vsock_vmci_transport /etc/modprobe.d/blacklist.conf --quiet ; then
cat >> /etc/modprobe.d/blacklist.conf <<EOF
blacklist vmw_vsock_vmci_transport"
EOF
fi
#Ensure hv_sock gets loaded
cat /etc/modules | grep hv_sock --quiet
if [ "$?" == "1" ]; then
bash -c 'echo "hv_sock" >> /etc/modules <<EOF
EOF'
if ! grep hv_sock /etc/modules --quiet ; then
echo "hv_sock" >> /etc/modules
fi
# Configure the policy xrdp session
bash -c 'cat >/etc/polkit-1/localauthority.conf.d/02-allow-colord.conf <<EOF
cat >/etc/polkit-1/localauthority.conf.d/02-allow-colord.conf <<EOF
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.color-manager.create-device" ||
action.id == "org.freedesktop.color-manager.modify-profile" ||
@ -86,7 +83,7 @@ polkit.addRule(function(action, subject) {
return polkit.Result.YES;
}
});
EOF'
EOF
# reconfigure the service
systemctl daemon-reload