Guest User

Untitled

a guest
Oct 28th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1. # Handle the incoming configuration files:
  2. config() {
  3.   for infile in $1; do
  4.     NEW="$infile"
  5.     OLD="`dirname $NEW`/`basename $NEW .new`"
  6.     # If there's no config file by that name, mv it over:
  7.     if [ ! -r $OLD ]; then
  8.       mv $NEW $OLD
  9.     elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then
  10.       # toss the redundant copy
  11.       rm $NEW
  12.     fi
  13.     # Otherwise, we leave the .new copy for the admin to consider...
  14.   done
  15. }
  16. preserve_perms() {
  17.   NEW="$1"
  18.   OLD="$(dirname ${NEW})/$(basename ${NEW} .new)"
  19.   if [ -e ${OLD} ]; then
  20.     cp -a ${OLD} ${NEW}.incoming
  21.     cat ${NEW} > ${NEW}.incoming
  22.     mv ${NEW}.incoming ${NEW}
  23.   fi
  24.   config ${NEW}
  25. }
  26.  
  27. #
  28. # Preserve permissions while moving into place:
  29. preserve_perms etc/rc.d/rc.elogind.new
  30.  
  31. #
  32. # Update rc.local so that elogind will be functional after boot:
  33. if ! grep "rc.elogind" etc/rc.d/rc.local 1>/dev/null 2>/dev/null ; then
  34.   cat <<_EOM_ >> etc/rc.d/rc.local
  35.  
  36. if [ -x /etc/rc.d/rc.elogind -a -x /usr/libexec/elogind ]; then
  37.   # Create runtime for elogind (standalone logind extracted from systemd):
  38.   /etc/rc.d/rc.elogind
  39. fi
  40. _EOM_
  41. fi
Advertisement
Add Comment
Please, Sign In to add comment