#!/bin/sh

# author: matteo <matteo@mageia.org>
# This script tries to update the razor-panel configuration file 
# located into the user home directory after backing it up

set -e

if [[ $EUID -ne 0 ]]; then
   echo "This script must be executed with root privileges"
   exit
fi


for i in `ls -1 /home/ | grep -v lost\+found`;
do
   if [[ -d "/home/${i}/.config/razor" ]]; then
      cp /home/$i/.config/razor/panel.conf /home/$i/.config/razor/panel.conf.backup
      cp /etc/razor/panel.conf /home/$i/.config/razor/
   else
      echo "Nothing to do for ${i}"
   fi
done

# It also looks for installed icon-themes (bug mga#11358)

rpm -qa | grep icon-theme 2>&1 > /dev/null
if [[ $? -eq 1 ]]; then
   # lets install the oxygen-icon-theme
   urpmi oxygen-icon-theme
fi
