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