1

Background We run a series of CentOS 6.5 servers which each host multiple users (~100s) coming in via X-Window XDMP from their MS Windows desktops. These users don't need the host of default applications that get launched, like pulse, volume-control, vino, polkit, etc. So we want to customize the default set of applications launched. However, we do routine yum updates on these machines and do not want our customization overwritten. Yum/rpm includes some provisions for preserving changes to designated configuration files.

Question We can customize the set of applications launched by either 1) deleting or 2) inserting the line "Hidden=true" into the appropriate .desktop files in /etc/xdg/autostart/, however, several of these .desktop files are not specified as configuration files in the RPM packages that install them (e.g. gnome-media, polkit-gnome, policycoreutils, vino). This means these files might be overwritten by a yum update operation should the package be updated.

Proposed Solution (1) Brute force: write an after-yum-update script which goes and redoes the changes we made. Either manually run this or perhaps yum can be customized to run it automatically.

Proposed Solution (2) Subtle but dicey: create our own custom RPM package which installs the files with changes. Then force this RPM to be installed. Future RPM updates that want to change the files will then halt because of the conflict. This will interrupt the routine yum update and we would follow a manual procedure to preserve/restore the customization.

Alternative solutions, thoughts and critiques are most welcome! Thanks.

Kevin Buchs
  • 313
  • 1
  • 3
  • 19
  • This is what configuration management systems are for. Puppet, chef, ansible, salt, cfengine, etc. Set up the conf management system to modify the files as you wish then you're done. RPM / yum update overwrites the file? Who cares, let the configuration management system put it back how you want. –  Dec 10 '14 at 21:06

1 Answers1

0

Here is the script I came up with for the brute-force approach #1:

#!/bin/bash

filelist1='at-spi-registryd.desktop
bluetooth-applet.desktop
gdu-notification-daemon.desktop
gnome-at-session.desktop
gnome-keyring-daemon.desktop
gnome-screensaver.desktop
gnome-user-share.desktop
gnome-volume-control-applet.desktop
gpk-update-icon.desktop
nm-applet.desktop
polkit-gnome-authentication-agent-1.desktop
pulseaudio.desktop
restorecond.desktop
seahorse-daemon.desktop
spice-vdagent.desktop
user-dirs-update-gtk.desktop
vino-server.desktop'

if [ ! -d /etc/xdg/autostart ]; then
    echo "The assumptions of this script are flawed. Aborting"
    echo "Directory /etc/xdg/autostart does not exist."
    exit
fi
cd /etc/xdg/autostart
mkdir -p save
for f in $filelist1;do
    if [ -f $f ]; then
       mv $f save; 
    else
       echo "/etc/xdg/autostart/$f not found";
    fi
done


if [ ! -f /usr/share/gnome/autostart/libcanberra-login-sound.desktop ]; then
    echo "The assumptions of this script are flawed. Aborting"
    echo "The file /usr/share/gnome/autostart/libcanberra-login-sound.desktop does not exist."
    exit
fi
cd /usr/share/gnome/autostart
mkdir -p save
mv libcanberra-login-sound.desktop save
if [ ! -f /usr/share/gnome/shutdown/libcanberra-logout-sound.sh ]; then
    echo "The assumptions of this script are flawed. Aborting"
    echo "The file /usr/share/gnome/shutdown/libcanberra-logout-sound.sh does not exist."
    exit
fi
cd /usr/share/gnome/shutdown
mkdir -p save
mv libcanberra-logout-sound.sh save
Kevin Buchs
  • 313
  • 1
  • 3
  • 19