Simplify vncpass and make systemd output less noisy

This commit is contained in:
2020-04-15 11:02:27 -04:00
parent c583a474ef
commit e722473e99

View File

@@ -46,10 +46,10 @@ USAGE:
OPTIONS OPTIONS
--rpmbuild --rpmbuild
Build RPM from source DEB (Default: install MC from repository) Debian/Ubuntu: Build RPM from source DEB
This will build the RPM on all OSes, and additionally install it on Fedora/CentOS Fedora/CentOS: Build RPM from source DEB and install it
--outputdir PATH --outputdir PATH
Generate rpmbuild output in this directory (Default: the current working directory) Generate rpmbuild output in this directory (Default: $PWD/outputdir)
--mcversion VERSION --mcversion VERSION
Build or install a specific version (Default: scrape the latest version from Interact) Build or install a specific version (Default: scrape the latest version from Interact)
--restorefile RESTOREFILE --restorefile RESTOREFILE
@@ -324,7 +324,7 @@ EOF
_sanityChecks () { _sanityChecks () {
# Cannot create a repo without an rpm # Cannot create a repo without an rpm
if [[ -n $_createrepo ]]; then if [[ -n $_createrepo || -n $_mcversion ]]; then
_rpmbuild="true" _rpmbuild="true"
fi fi
@@ -647,11 +647,7 @@ EOF"
_setVNCPass () { _setVNCPass () {
if [[ "$_user" == "root" ]]; then
_vncpassfile="/root/.vnc/jrmc_passwd"
else
_vncpassfile="$HOME/.vnc/jrmc_passwd" _vncpassfile="$HOME/.vnc/jrmc_passwd"
fi
if [[ -n $_vncpass ]]; then if [[ -n $_vncpass ]]; then
# Remove existing password file if it exists and write a new one # Remove existing password file if it exists and write a new one
@@ -666,14 +662,14 @@ EOF"
_systemctlReloadAndEnable () { _systemctlReloadAndEnable () {
[[ -n $_debug ]] && echo "Enabling $1" echo "Enabling $1"
if [[ "$_user" == "root" ]]; then if [[ "$_user" == "root" ]]; then
systemctl daemon-reload systemctl daemon-reload
systemctl enable --now "$1" systemctl enable --now "$1" > /dev/null 2>&1
else else
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable --now "$1" sudo systemctl enable --now "$1" > /dev/null 2>&1
fi fi
} }
@@ -806,12 +802,12 @@ EOF"
&& "${_rm_cmd[@]}" "/etc/apt/sources.list.d/jriver.list" && "${_rm_cmd[@]}" "/etc/apt/sources.list.d/jriver.list"
if [[ -x $(command -v firewall-cmd) ]]; then if [[ -x $(command -v firewall-cmd) ]]; then
echo "Removing firewall rules" echo "Removing firewall rules"
sudo firewall-cmd --permanent --remove-service=jriver sudo firewall-cmd --permanent --remove-service=jriver > /dev/null 2>&1
sudo firewall-cmd --permanent --delete-service=jriver sudo firewall-cmd --permanent --delete-service=jriver > /dev/null 2>&1
sudo firewall-cmd --reload sudo firewall-cmd --reload > /dev/null 2>&1
elif [[ -x $(command -v ufw) ]]; then elif [[ -x $(command -v ufw) ]]; then
echo "Removing firewall rules" echo "Removing firewall rules"
sudo ufw delete allow jriver sudo ufw delete allow jriver > /dev/null 2>&1
[[ -f "/etc/ufw/applications.d/jriver.service" ]] \ [[ -f "/etc/ufw/applications.d/jriver.service" ]] \
&& "${_rm_cmd[@]}" /etc/ufw/applications.d/jriver.service && "${_rm_cmd[@]}" /etc/ufw/applications.d/jriver.service
fi fi
@@ -826,7 +822,6 @@ EOF"
} }
__main () { __main () {
# Check user # Check user