#!/bin/bash # # TODO: Factorize for Mageia 2 # KRCFG="$(which kreadconfig)" if [ ! -z "$KRCFG" ]; then # Check if kde is installed, otherwise do nothing # Powersave applet PSAVE=$(kreadconfig --group "Mageia" --key "PowersaveApplet" --default "false") LAP=$(kreadconfig --file "/etc/sysconfig/harddrake2/kernel" --key IS_LAPTOP --default "false") if [ "$LAP" = "true" ]; then if [ ! "$PSAVE" = "true" ]; then MDVPSAVE=$(kreadconfig --group "Mandriva" --key "PowersaveApplet" --default "false") if [ "$MDVPSAVE" = "true" ]; then kwriteconfig --group "Mageia" --key "PowersaveApplet" --type "bool" 1 elif [ ! -f "$HOME/.kde4/share/config/plasma-desktop-appletsrc" ]; then mkdir -p $HOME/.kde4/share/config cat >> $HOME/.kde4/share/config/plasma-desktop-appletsrc << EOF [Containments][2][Applets][9][Configuration][Applets][19] geometry=298,0,24,24 immutability=1 plugin=battery zvalue=0 [Containments][2][Applets][9][Configuration][Applets][19][Configuration] Share=false showMultipleBatteries=false [Containments][2][Applets][9][Configuration][Applets][19][Configuration][ExtenderItems][4] extenderIconName=battery extenderItemName=powermanagement extenderItemPosition=0 isCollapsed=false sourceAppletId=19 sourceAppletPluginName=battery EOF kwriteconfig --group "Mageia" --key "PowersaveApplet" --type "bool" 1 fi fi fi # "Desktop" Mageia icons" MGADESK=$(kreadconfig --group "Mageia" --key "MageiaDesktopFiles" --default "false") if [ ! "$MGADESK" = "true" ]; then # TODO: We need to handle default => Default too PROD=$(sed 's/.*product=\(.*\)/\L\1/' < /etc/product.id) # We should handle i18n dir modes in xgd user dirs DIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DESKTOP_DIR)" ) if [ -z $DIR ]; then DIR="$HOME/Desktop" fi if [ ! -d "${DIR}" ]; then mkdir -p "${DIR}" fi if [ -n "$PROD" -a -d "/usr/share/dist/desktop-files/${PROD}" ]; then cp -f /usr/share/dist/desktop-files/${PROD}/*.desktop "${DIR}" fi kwriteconfig --group "Mageia" --key "MageiaDesktopFiles" --type "bool" 1 fi # Copy the "Welcome" icon on the desktop WELCOME=$(kreadconfig --group "Mageia" --key "Welcome" --default "false") if [ ! "$WELCOME" = "true" ]; then # We should handle i18n dir modes in xgd user dirs DIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DESKTOP_DIR)" ) if [ -z $DIR ]; then DIR="$HOME/Desktop" fi if [ ! -d "${DIR}" ]; then mkdir -p "${DIR}" fi # We maybe migrating from mandriva so we remove the old file which may have a broken icon if [ -f "${DIR}/Welcome.desktop" ]; then rm -f "${DIR}/Welcome.desktop" fi kwriteconfig --group "Mageia" --key "Welcome" --type "bool" 1 fi # Copy the "Trash" icon on the desktop TRASH=$(kreadconfig --group "Mageia" --key "Trash" --default "false") if [ ! "$TRASH" = "true" ]; then # We should handle i18n dir modes in xgd user dirs DIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DESKTOP_DIR)" ) if [ -z $DIR ]; then DIR="$HOME/Desktop" fi if [ ! -d "${DIR}" ]; then mkdir -p "${DIR}" fi cp -f /usr/share/applications/kde4/trash.desktop "${DIR}" kwriteconfig --group "Mageia" --key "Trash" --type "bool" 1 fi # Test old iaora IAORAKDE=$(kreadconfig --group "Mageia" --key "IaOraKDE" --default "false") if [ ! "$IAORAKDE" = "true" ]; then IAORAQT=$(kreadconfig --group "General" --key "widgetStyle") if [ "$IAORAQT" = "iaora-qt" ]; then kwriteconfig --group "General" --key "widgetStyle" --type "string" "iaorakde" fi kwriteconfig --group "Mageia" --key "IaOraKDE" --type "bool" 1 fi # Copy the "File Manager" icon on the desktop FILEM=$(kreadconfig --group "Mageia" --key "FileManager" --default "false") if [ ! "$FILEM" = "true" ]; then # We should handle i18n dir modes in xgd user dirs DIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DESKTOP_DIR)" ) if [ -z $DIR ]; then DIR="$HOME/Desktop" fi if [ ! -d "${DIR}" ]; then mkdir -p "${DIR}" fi if [ -e "${DIR}/Home.desktop" ]; then rm -f "${DIR}/Home.desktop" fi cp -f /usr/share/applications/kde4/Home2.desktop "${DIR}" kwriteconfig --group "Mageia" --key "FileManager" --type "bool" 1 fi OLDICON=$(kreadconfig --group "Mageia" --key "IconMigration" --default "false") if [ ! "$OLDICON" = "true" ]; then # We need to remove the old mdv icons ( music, video, download ) and use KDE ones instead MUSICDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_MUSIC_DIR)" ) if [ -z "$MUSICDIR" ]; then MUSICDIR="$HOME/Music" fi if [ -f "$MUSICDIR/.directory" ]; then ICON=$(kreadconfig --file $MUSICDIR/.directory --key Icon) if [ "$ICON" == "mdk-music.png" ]; then kwriteconfig --file "$MUSICDIR/.directory" --key Icon folder-sound fi fi if [ ! -e "$MUSICDIR/.directory" ]; then cat >> "$MUSICDIR/.directory" << EOF [Desktop Entry] Hidden=true Icon=folder-sound EOF fi DLDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DOWNLOAD_DIR)" ) if [ -z "$DLDIR" ]; then DLDIR="$HOME/Download" fi if [ -f "$DLDIR/.directory" ]; then ICON=$(kreadconfig --file $DLDIR/.directory --key Icon) if [ "$ICON" == "download-mdk.png" ]; then kwriteconfig --file "$DLDIR/.directory" --key Icon folder-downloads fi fi if [ ! -e "$DLDIR/.directory" ]; then cat >> "$DLDIR/.directory" << EOF [Desktop Entry] Hidden=true Icon=folder-downloads EOF fi DOCDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DOCUMENTS_DIR)" ) if [ -z "$DOCDIR" ]; then DOCDIR="$HOME/Download" fi if [ -f "$DOCDIR/.directory" ]; then ICON=$(kreadconfig --file $DOCDIR/.directory --key Icon) if [ "$ICON" == "document-mdk.png" ]; then kwriteconfig --file "$DOCDIR/.directory" --key Icon folder-documents fi fi if [ ! -e "$DOCDIR/.directory" ]; then cat >> "$DOCDIR/.directory" << EOF [Desktop Entry] Hidden=true Icon=folder-documents EOF fi PICTUREDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_PICTURES_DIR)" ) if [ -z "$PICTUREDIR" ]; then PICTUREDIR="$HOME/Picture" fi if [ -f "$PICTUREDIR/.directory" ]; then ICON=$(kreadconfig --file $PICTUREDIR/.directory --key Icon) if [ "$ICON" == "picture-mdk.png" ]; then kwriteconfig --file "$PICTUREDIR/.directory" --key Icon folder-image fi fi if [ ! -e "$PICTUREDIR/.directory" ]; then cat >> "$PICTUREDIR/.directory" << EOF [Desktop Entry] Hidden=true Icon=folder-image EOF fi VIDEOSDIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_VIDEOS_DIR)" ) if [ -z "$VIDEOSDIR" ]; then VIDEOSDIR="$HOME/Video" fi if [ -f "$VIDEOSDIR/.directory" ]; then ICON=$(kreadconfig --file $VIDEOSDIR/.directory --key Icon) if [ "$ICON" == "video-mdk.png" ]; then kwriteconfig --file "$VIDEOSDIR/.directory" --key Icon folder-video fi fi if [ ! -e "$VIDEOSDIR/.directory" ]; then cat >> "$VIDEOSDIR/.directory" << EOF [Desktop Entry] Hidden=true Icon=folder-video EOF fi kwriteconfig --group "Mageia" --key "IconMigration" --type "bool" 1 fi # We need to check desktop files created at first mdv start and remove or migrate for mageia MIGRATE=$(kreadconfig --group "Mageia" --key "MdvMigrate" --default "false") if [ ! "$MIGRATE" = "true" ]; then DIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DESKTOP_DIR)" ) if [ -z $DIR ]; then DIR="$HOME/Desktop" fi if [ -f "${DIR}/upgrade.desktop" ]; then rm -f "${DIR}/upgrade.desktop" fi for configFile in "$HOME/.kde4/share/config/kickoffrc" \ "$HOME/.kde4/share/config/plasma-desktop-appletsrc" \ "$HOME/.kde4/share/config/lancelotrc"; do if [ -f $configFile ] && [ ! -f "$configFile.MdvToMga" ]; then # save the config file before cp -p $configFile "$configFile.MdvToMga" # migrate mandriva-*.desktop to mageia-*.desktop sed -i -e "s#/usr/share/applications/mandriva-\(.*\).desktop#/usr/share/applications/mageia-\1.desktop#g" $configFile # migrate openoffice .desktop to libreoffice .desktop for officeFile in base calc draw impress math startcenter writer; do sed -i -e "s#/usr/share/applications/$officeFile.desktop#/usr/share/applications/libreoffice-$officeFile.desktop#g" $configFile done fi done # migrate lancelot system apps and newdocuments if [ -h "$HOME/.kde4/share/apps/lancelot/systemservices/1_mandriva-drakconf.desktop" ] && [ -f /usr/share/applications/mageia-drakconf.desktop ]; then rm -f "$HOME/.kde4/share/apps/lancelot/systemservices/1_mandriva-drakconf.desktop" ln -sf /usr/share/applications/mageia-drakconf.desktop "$HOME/.kde4/share/apps/lancelot/systemservices/1_mageia-drakconf.desktop" fi if [ -h "$HOME/.kde4/share/apps/lancelot/newdocuments/1_writer.desktop" ] && [ -f /usr/share/applications/libreoffice-writer.desktop ]; then rm -f "$HOME/.kde4/share/apps/lancelot/newdocuments/1_writer.desktop" ln -sf /usr/share/applications/libreoffice-writer.desktop "$HOME/.kde4/share/apps/lancelot/newdocuments/1_libreoffice-writer.desktop" fi if [ -h "$HOME/.kde4/share/apps/lancelot/newdocuments/3_impress.desktop" ] && [ -f /usr/share/applications/libreoffice-impress.desktop ]; then rm -f "$HOME/.kde4/share/apps/lancelot/newdocuments/3_impress.desktop" ln -sf /usr/share/applications/libreoffice-impress.desktop "$HOME/.kde4/share/apps/lancelot/newdocuments/3_libreoffice-impress.desktop" fi if [ -h "$HOME/.kde4/share/apps/lancelot/newdocuments/5_calc.desktop" ] && [ -f /usr/share/applications/libreoffice-calc.desktop ]; then rm -f "$HOME/.kde4/share/apps/lancelot/newdocuments/5_calc.desktop" ln -sf /usr/share/applications/libreoffice-calc.desktop "$HOME/.kde4/share/apps/lancelot/newdocuments/5_libreoffice-calc.desktop" fi kwriteconfig --group "Mageia" --key "MdvMigrate" --type "bool" 1 fi # end of main if: all the changes should be done inside this main if fi