vSphere web client error

If you see this error, you probably see it every time you log in. Isn’t it frustrating?

An internal error has occurred - Unable to load resource module from /EBR2/locales/EBR-en_US.swf.

Reloading the client is recommended, so as to clear any problems left by this error.

Click Yes to reload the vSphere Web Client?

And the error stack:

Error: Unable to load resource module from /EBR2/locales/EBR-en_US.swf
	at MethodInfo-666()
	at flash.events::EventDispatcher/dispatchEvent()
	at ModuleInfoProxy/moduleEventHandler()
	at flash.events::EventDispatcher/dispatchEvent()
	at ModuleInfo/errorHandler()

The solution comes from the bowels of the Internet.

To avoid this issue, add port 9443 into the vsphere Web Client browse request, and then open the vcenter. Type the following address: https://<vcenter_ip&gt;:9443 where: vscenter_ip is the IP address of the vsphere Web Client.

References

Weblinks

http://docplayer.net/18033329-Emc-networker-vmware-integration-guide-version-8-2-sp1-and-later-302-001-580-rev-14.html

Searches

https://duckduckgo.com/?q=g!+%22%2FEBR2%2Flocales%2FEBR-en_US.swf%22&ia=web

Devuan and Dell D630 graphics issue

On one of my Dell D630s running Devuan GNU/Linux, I ran into an interesting issue. It does not occur on my other D630, so there’s hope. Originally I actually changed from my i686 installation of Devuan ascii to the x86_64 version, but the problem still persistent.

After a few minutes of dedicated searching, I found the answer!

tl;dr

Put on the kernel line:

video=SVIDEO-1:d

Normally in /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="quiet video=SVIDEO-1:d"
And then you have to run:
grub-mkconfig -o /boot/grub/grub.cfg

Explanation

The symptom of my problem occurs when changing screen resolutions in X11, or switching to or from the X11 display to a different tty. The mouse responds and moves around the (graphical) screens, but nothing else is updated for about 10 seconds.

I investigated dmesg, and it shows the very interesting results at the bottom of the post. After shortening the snippet to paste into Internet search engines, I finally found an answer! This bug has something to do with handling the svideo output. Disabling the svideo output (my Dell Latitude D630 does not even have one!) makes the issue go away.

[  168.672218] [drm:drm_atomic_helper_commit_cleanup_done [drm_kms_helper]] *ERROR* [CRTC:29:pipe B] flip_done timed out
[  168.776236] ------------[ cut here ]------------
[  168.776296] WARNING: CPU: 1 PID: 2274 at /build/linux-6WgLIg/linux-4.9.88/drivers/gpu/drm/drm_irq.c:1254 drm_wait_one_vblank+0x197/0x1a0 [drm]
[  168.776299] vblank wait timed out on crtc 1
[  168.776302] Modules linked in: appletalk ax25 ipx p8023 p8022 psnap llc bnep bluetooth rpcsec_gss_krb5 nfsv4 dns_resolver nfsd auth_rpcgss oid_registry nfs_acl nfs lockd grace fscache sunrpc parport_pc ppdev lp parport iTCO_wdt iTCO_vendor_support b43 bcma snd_hda_codec_idt snd_hda_codec_generic mac80211 snd_hda_intel snd_hda_codec cfg80211 coretemp snd_hda_core dell_wmi kvm_intel sparse_keymap dell_rbtn rng_core dell_laptop kvm snd_hwdep yenta_socket snd_pcm dell_smbios rfkill snd_timer snd dcdbas dell_smm_hwmon irqbypass soundcore lpc_ich pcmcia_rsrc i915 mfd_core joydev pcspkr evdev serio_raw drm_kms_helper shpchp battery video wmi button ac drm i2c_algo_bit acpi_cpufreq ext4 crc16 jbd2 crc32c_generic fscrypto ecb glue_helper lrw gf128mul ablk_helper cryptd aes_x86_64 mbcache dm_mod sr_mod cdrom
[  168.776470]  sg sd_mod hid_generic ata_generic usbhid hid psmouse firewire_ohci ata_piix i2c_i801 ssb i2c_smbus mmc_core pcmcia firewire_core crc_itu_t pcmcia_core libata tg3 ptp pps_core libphy scsi_mod thermal ehci_pci uhci_hcd ehci_hcd usbcore usb_common
[  168.776532] CPU: 1 PID: 2274 Comm: Xorg Tainted: G        W       4.9.0-6-amd64 #1 Debian 4.9.88-1+deb9u1
[  168.776535] Hardware name: Dell Inc. Latitude D630                   /0KU184, BIOS A08 02/28/2008
[  168.776540]  0000000000000000 ffffffff9312f774 ffffb93e40b1f980 0000000000000000
[  168.776551]  ffffffff92e78a5e ffff9dc735860000 ffffb93e40b1f9d8 0000000000000000
[  168.776559]  0000000007000df1 ffff9dc77bc8a898 ffff9dc736bf2800 ffffffff92e78adf
[  168.776568] Call Trace:
[  168.776582]  [] ? dump_stack+0x5c/0x78
[  168.776591]  [] ? __warn+0xbe/0xe0
[  168.776597]  [] ? warn_slowpath_fmt+0x5f/0x80
[  168.776604]  [] ? finish_wait+0x3c/0x70
[  168.776642]  [] ? drm_wait_one_vblank+0x197/0x1a0 [drm]
[  168.776648]  [] ? prepare_to_wait_event+0xf0/0xf0
[  168.776733]  [] ? intel_get_load_detect_pipe+0x624/0x640 [i915]
[  168.776799]  [] ? intel_tv_detect+0x15a/0x590 [i915]
[  168.776828]  [] ? drm_helper_probe_single_connector_modes+0x432/0x520 [drm_kms_helper]
[  168.776866]  [] ? drm_mode_object_get_properties+0xd7/0x100 [drm]
[  168.776904]  [] ? drm_mode_getconnector+0x32a/0x360 [drm]
[  168.776938]  [] ? drm_ioctl+0x1ed/0x470 [drm]
[  168.776975]  [] ? drm_mode_connector_property_set_ioctl+0x60/0x60 [drm]
[  168.776984]  [] ? __fpu__restore_sig+0x7b/0x580
[  168.776992]  [] ? do_vfs_ioctl+0xa2/0x620
[  168.776997]  [] ? SyS_ioctl+0x74/0x80
[  168.777004]  [] ? do_syscall_64+0x8d/0xf0
[  168.777011]  [] ? entry_SYSCALL_64_after_swapgs+0x58/0xc6
[  168.777016] ---[ end trace 8f754217765c1d43 ]---
[  168.921006] ------------[ cut here ]------------

References

Weblinks

  1. https://bugs.freedesktop.org/show_bug.cgi?id=93782

Searches

https://duckduckgo.com/?q=g!+drm_irq.c%3A1254+drm_wait_one_vblank%2B0x197%2F0x1a0&ia=web

Learn when a user was added or removed from AD domain group

Ripped shamelessly from https://learn-powershell.net/2013/05/21/find-when-a-user-was-added-or-removed-to-a-domain-group-using-powershell-and-repadmin/

I was investigating when a user was added to a group the other day, because I completely missed a member of a different team being added to my linux_admins group, which gets full sudo privileges on every GNU/Linux system in the corporate network.

repadmin /showobjmeta dc1 'CN=Domain Admins,CN=Users,DC=example,DC=com'

Notes on reacting to ssh key used to connect to server

The answers to https://unix.stackexchange.com/questions/15575/can-i-find-out-which-ssh-key-was-used-to-access-an-account provide some interesting details I’ve never seen before.

You can specify a command to run in the ~/.ssh/authorized_keys file:

command="/usr/share/bgscripts/work/react-ssh.sh ; /bin/bash" ssh-rsa AAAAB3NgaC1yc2EAAAABJQAAANEAnYh0nq5dzOgIgfkh50Th68hZoX+zR[...output truncated...]

Inside my example react-ssh.sh file:

journalctl -n30 -u sshd.service 2>/dev/null | grep -E "sshd\[$( ps --noheaders -o ppid $( ps --noheaders -o ppid $( ps --noheaders -o ppid $$ ) ) | xargs )]: Accepted publickey for ${USER}" | tail -n1 | awk '{print $(NF-1),$NF}'

So when I log in with an ssh key, it will print it out for me:

[bgstack15@example1|/home/bgstack15]$ ssh example2
RSA SHA256:I3wuJRyf1dWCzeqdLl6mWfMl9wONJLk38/xUwLCiNgA
[bgstack15@example2 ~]$

Here is a script that could be called with a parameter to show the entire public key of the hash.

#!/bin/sh
# to show the full public key of the provided hash
test -z "${SFK_AUTHORIZED_KEYS}" && SFK_AUTHORIZED_KEYS=~/.ssh/authorized_keys

SFK_HASHES="$( ssh-keygen -l -f "${SFK_AUTHORIZED_KEYS}" )"
for word in $@ ;
do
   sed -n -r -e "$( echo "${SFK_HASHES}" | grep -hn "${word}" | awk -F':' '{print $1}' )p" "${SFK_AUTHORIZED_KEYS}"
done

Add user agent overrides in Pale Moon

Pale Moon is a wonderful web browser. I use it as a daily driver. Some websites think it is outdated and will actually send a page saying, “Your browser is outdated. Please update to a modern browser to use this site.”

I disagree with their assessment. Additionally, Pale Moon has the ability to change the user agent when talking to domains. You can just make a new entry in the about:config page.

general.useragent.override.deviantart.net Mozilla/5.0 (X11; Linux x86_64; rv:3.4) Goanna/20170101 PaleMoon/27.6.1
general.useragent.override.netflix.com Mozilla/5.0 (X11; Linux x86_64; rv:45.9) Gecko/20100101 Firefox/45.9

Just make a new entry with name: general.useragent.override.domain.com. And just experiment with the user agent string to send until you get it right for the site in question.

Compiling FreeFileSync 10.0 on Fedora

When compiling the latest release of FreeFileSync, I came across this error (after applying my basic Fedora patches):

cc1plus: warning: ../../boost: No such file or directory [-Wmissing-include-dirs]
g++ -o ../Build/FreeFileSync ../Obj/FFS_GCC_Make_Release/ffs/src/algorithm.o ../Obj/FFS_GCC_Make_Release/ffs/src/application.o ../Obj/FFS_GCC_Make_Release/ffs/src/comparison.o ../Obj/FFS_GCC_Make_Release/ffs/src/structures.o ../Obj/FFS_GCC_Make_Release/ffs/src/synchronization.o ../Obj/FFS_GCC_Make_Release/ffs/src/fs/abstract.o ../Obj/FFS_GCC_Make_Release/ffs/src/fs/concrete.o ../Obj/FFS_GCC_Make_Release/ffs/src/fs/native.o ../Obj/FFS_GCC_Make_Release/ffs/src/file_hierarchy.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/batch_config.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/batch_status_handler.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/cfg_grid.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/command_box.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/folder_history_box.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/folder_selector.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/file_grid.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/file_view.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/tree_grid.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/gui_generated.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/gui_status_handler.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/main_dlg.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/progress_indicator.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/search.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/small_dlgs.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/sync_cfg.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/taskbar.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/tray_icon.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/triple_splitter.o ../Obj/FFS_GCC_Make_Release/ffs/src/ui/version_check.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/binary.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/db_file.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/dir_lock.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/ffs_paths.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/generate_logfile.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/hard_filter.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/icon_buffer.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/icon_loader.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/localization.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/parallel_scan.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/process_xml.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/resolve_path.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/perf_check.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/status_handler.o ../Obj/FFS_GCC_Make_Release/ffs/src/lib/versioning.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/xml_io.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/recycler.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/file_access.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/file_io.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/file_traverser.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/zstring.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/format_unit.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/process_priority.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../zen/shutdown.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/file_drop.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/grid.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/image_tools.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/graph.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/http.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/tooltip.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/image_resources.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/popup_dlg.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/popup_dlg_generated.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/zlib_wrap.o ../Obj/FFS_GCC_Make_Release/ffs/src/../../xBRZ/src/xbrz.o -s -no-pie `wx-config --libs std, aui --debug=no` -pthread `pkg-config --libs   gtk+-3.0` `pkg-config --libs libselinux`
/usr/bin/ld: ../Obj/FFS_GCC_Make_Release/ffs/src/../../wx+/zlib_wrap.o: undefined reference to symbol 'compressBound@@ZLIB_1.2.0'
//usr/lib64/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:103: ../Build/FreeFileSync] Error 1

After some Internet searches, I found the answer!

All you have to do is fix the linking to include the -lz flag. In fact, previous versions of the software included the -lz flag in the makefile. It was probably removed as an oversight, but it compiled and operated on Fedora GNU/Linux once I added back in the linking flag. I guess omitting the z library prevents the binary from building successfully! Who’da thunk it?

Here is the diff:

--- 10.0-0/FreeFileSync/Source/Makefile	2018-04-26 16:57:13.000000000 -0400
+++ 10.0-1/FreeFileSync/Source/Makefile	2018-05-01 07:13:57.430369158 -0400
@@ -9,11 +9,11 @@
 -Wall -Wfatal-errors  -Winit-self -Wmissing-include-dirs -Wswitch-enum -Wmain -Wnon-virtual-dtor -Wcast-align -Wshadow -Wno-deprecated-declarations \
 -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread
 
-LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -pthread
+LINKFLAGS = -s -no-pie `wx-config --libs std, aui --debug=no` -lz -pthread
 
 #Gtk - support recycler/icon loading/no button border/grid scrolling
-CXXFLAGS  += `pkg-config --cflags gtk+-2.0`
-LINKFLAGS += `pkg-config --libs   gtk+-2.0`
+CXXFLAGS  += `pkg-config --cflags gtk+-3.0`
+LINKFLAGS += `pkg-config --libs   gtk+-3.0`
 
 #support for SELinux (optional)
 SELINUX_EXISTING=$(shell pkg-config --exists libselinux && echo YES)

References

Weblinks

  1. https://stackoverflow.com/questions/19901934/strange-linking-error-dso-missing-from-command-line/20206371#20206371
  2. Discussion about linking to a lib in general https://github.com/JuliaLang/julia/issues/4742

RHEL7 and sssd: getent works but users cannot authenticate with passwords

In my situation, we used realm to install and configure sssd. Getent shows the domain users, and the groups are in /etc/ssh/sshd_config and /etc/sssd/sssd.conf. So why can my users not authenticate to the server?!

I get this error:

May 01 13:53:43 lhostname sshd[22167]: pam_sss(sshd:auth): authentication success; logname= uid=0 euid=0 tty=ssh ruser= rhost=l982487.prod1.example.com user=bgstack15
May 01 13:53:44 lhostname sshd[22167]: Failed password for bgstack15 from 10.155.16.240 port 34340 ssh2

What eventually solved the problem was fixing /etc/pam.d/system-auth-ac and also /etc/pam.d/password-auth-ac. Either file by itself did not seem to help. It looks like authconfig may have messed up or was not used or something. I don’t bother using it myself because I just modify pam myself. Yes, this makes me a terrible admin.

/etc/pam.d/system-auth-ac

#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        required      pam_faildelay.so delay=2000000
auth        required      pam_faillock.so preauth silent deny=4 unlock_time=1200
auth        sufficient    pam_fprintd.so
auth        [default=1 ignore=ignore success=ok] pam_succeed_if.so uid >= 1000 quiet
auth        [default=1 ignore=ignore success=ok] pam_localuser.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 1000 quiet_success
auth        sufficient    pam_sss.so forward_pass
auth        required      pam_faillock.so authfail deny=4 unlock_time=1200
auth        required      pam_deny.so

account     required      pam_faillock.so
account     required      pam_unix.so
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 1000 quiet
account     [default=bad success=ok user_unknown=ignore] pam_sss.so
account     required      pam_permit.so

password    requisite     pam_pwquality.so minlen=16 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=-1 try_first_pass retry=3
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok remember=5
password    sufficient    pam_sss.so use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     optional      pam_oddjob_mkhomedir.so umask=0077
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_sss.so

/etc/pam.d/password-auth-ac

#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        required      pam_faildelay.so delay=2000000
auth        required      pam_faillock.so preauth silent deny=4 unlock_time=1200
auth        [default=1 ignore=ignore success=ok] pam_succeed_if.so uid >= 1000 quiet
auth        [default=1 ignore=ignore success=ok] pam_localuser.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 1000 quiet_success
auth        sufficient    pam_sss.so forward_pass
auth        required      pam_deny.so

account     required      pam_faillock.so
account     required      pam_unix.so
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 1000 quiet
account     [default=bad success=ok user_unknown=ignore] pam_sss.so
account     required      pam_permit.so

password    requisite     pam_pwquality.so minlen=16 dcredit=-1 ucredit=-1 ocredit=-1 lcredit=-1 try_first_pass retry=3
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password    sufficient    pam_sss.so use_authtok

auth        required      pam_faillock.so authfail deny=4 unlock_time=1200

password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     optional      pam_oddjob_mkhomedir.so umask=0077
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_sss.so

Update /etc/default/grub programmatically

My latest bgconf package includes my grub preferences for RHEL-based systems.

I allow for environment variable overrides, but the defaults are to disable rhgb and quiet. If you have been looking for a way to easily remove red hat graphical boot (rhgb) so you can actually see the kernel messages scroll by, you want this script.

#!/bin/sh

# DEFINE FUNCTIONS

clean_mgm() {
   rm -rf "${MGM_TMPDIR}" 2>/dev/null
}

update_grub_if_changed() {
   # call: update_grub_if_changed "${MGM_INFILE}" "${MGM_TMPFILE1}"

   local infile="${1}"
   local tmpfile="${2}"

   # determine if changes were made to the file
   if diff -q "${infile}" "${tmpfile}" 2>&1 | grep -qiE 'differ' ;
   then
      # changes were made
      if fistruthy "${MGM_APPLY}" ;
      then
         sudo /bin/cp -p "${tmpfile}" "${infile}"
         sudo /usr/sbin/grub2-mkconfig -o "${MGM_GRUB_FILE:-/boot/grub2/grub.cfg}"
      fi
   else
      # no changes
      :
   fi

}

add_value_to_grub_line() {
   # call: add_value_to_grub_line "${MGM_TMPFILE1}" "GRUB_CMDLINE_LINUX" "quiet"

   local infile="${1}"
   local thisvar="${2}"
   local thisvalue="${3}"

   sed -i -r -e "/^${thisvar}=/{ /${thisvalue}/! { s/\"\s*\$/${thisvalue}\"/; } ; }" "${infile}"

}

remove_value_from_grub_line() {
   # call: remove_value_from_grub_line "${MGM_TMPFILE1}" "GRUB_CMDLINE_LINUX" "quiet"

   local infile="${1}"
   local thisvar="${2}"
   local thisvalue="${3}"

   sed -i -r -e "/^${thisvar}=/{ /${thisvalue}/ { s/\s*${thisvalue}//; } ; }" "${infile}"

}

# REACT TO OS
# fail out if not rhel-based
. /usr/share/bgscripts/framework.sh
case "${thisflavor}" in
   fedora|el|centos|korora) : ;;
   *) exit 0 ;;
esac

# set variables
test -z "${MGM_TMPDIR}" && MGM_TMPDIR="$( mktemp -d )"
test -z "${MGM_TMPFILE1}" && MGM_TMPFILE1="$( TMPDIR="${MGM_TMPDIR}" mktemp )"

test -z "${MGM_INFILE}" && MGM_INFILE=/etc/default/grub
test -z "${MGM_GRUB_FILE}" && MGM_GRUB_FILE=/boot/grub2/grub.cfg
test -z "${MGM_APPLY}" && MGM_APPLY=yes
test -z "${MGM_RHGB}" && MGM_RHGB=no
test -z "${MGM_QUIET}" && MGM_QUIET=no

# clean up temp file if necessary
test ! -e "${MGM_TMPFILE1}" && { touch "${MGM_TMPFILE1}" || exit 1 ; }
cat "${MGM_INFILE}" > "${MGM_TMPFILE1}"
trap '__ec=$? ; clean_mgm ; trap "" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; exit ${__ec:-0} ;' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

# Do the RHGB action
if fistruthy "${MGM_RHGB}" ;
then
   # add rhgb to grub config
   add_value_to_grub_line "${MGM_TMPFILE1}" "GRUB_CMDLINE_LINUX" "rhgb"
else
   # remove rhgb
   remove_value_from_grub_line "${MGM_TMPFILE1}" "GRUB_CMDLINE_LINUX" "rhgb"
fi

# Do the QUIET action
if fistruthy "${MGM_QUIET}" ;
then
   # add quiet to grub config
   add_value_to_grub_line "${MGM_TMPFILE1}" "GRUB_CMDLINE_LINUX" "quiet"
else
   # remove quiet
   remove_value_from_grub_line "${MGM_TMPFILE1}" "GRUB_CMDLINE_LINUX" "quiet"
fi

# Determine if any changes occurred to the file
update_grub_if_changed "${MGM_INFILE}" "${MGM_TMPFILE1}"

# show final results
fistruthy "${MGM_VERBOSE}" && cat "${MGM_TMPFILE1}"