#!/bin/bash # # Factorize for 2010.0 # KRCFG="$(which kreadconfig)" if [ ! -z "$KRCFG" ]; then # Check if kde is installed, otherwise do nothing # Powersave applet CFGFILE="/etc/sysconfig/harddrake2/kernel" PSAVE=$(kreadconfig --group "Mandriva" --key "PowersaveApplet" --default "false") LAP=$(kreadconfig --file "/etc/sysconfig/harddrake2/kernel" --key IS_LAPTOP --default "false") if [ "$LAP" = "true" ]; then if [ ! "$PSAVE" = "true" ]; then if [ ! -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 "Mandriva" --key "PowersaveApplet" --type "bool" 1 fi fi fi # "Desktop" Mandriva icons" PSAVE=$(kreadconfig --group "Mandriva" --key "MandrivaIcons" --default "false") if [ ! "$PSAVE" = "true" ]; then 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 cp -f /usr/share/mdk/desktop/${PROD}/*.desktop "${DIR}" kwriteconfig --group "Mandriva" --key "MandrivaIcons" --type "bool" 1 fi # mandrivalauncher is simplelauncher now PSAVE=$(kreadconfig --group "Mandriva" --key "NewLauncher" --default "false") if [ ! "$PSAVE" = "true" ]; then RES="$HOME/.kde4/share/config/plasma-desktop-appletsrc" [ -f $RES ] && sed -i "s,mandrivalauncher,simplelauncher,g" $RES kwriteconfig --group "Mandriva" --key "NewLauncher" --type "bool" 1 fi # Copy the "Welcome" icon on the desktop WELCOME=$(kreadconfig --group "Mandriva" --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 if [ -x /usr/bin/mandrivagalaxy.real ]; then cp -f /usr/share/applications/kde4/Welcome.desktop "${DIR}" fi kwriteconfig --group "Mandriva" --key "Welcome" --type "bool" 1 fi # Copy the "Trash" icon on the desktop TRASH=$(kreadconfig --group "Mandriva" --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 "Mandriva" --key "Trash" --type "bool" 1 fi # Test old iaora IAORAKDE=$(kreadconfig --group "Mandriva" --key "IaOraKDE" --default "false") if [ ! "$IAORAKDE" = "false" ]; then IAORAQT=$(kreadconfig --group "General" --key "widgetStyle") if [ "$IAORAQT" = "iaora-qt" ]; then kwriteconfig --group "General" --key "widgetStyle" --type "string" "iaorakde" fi kwriteconfig --group "Mandriva" --key "IaOraKDE" --type "bool" 1 fi # Copy the "File Manager" icon on the desktop FILEM=$(kreadconfig --group "Mandriva" --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 if [ ! -e "${DIR}/Home2.desktop" ]; then cp -f /usr/share/applications/kde4/Home2.desktop "${DIR}" fi kwriteconfig --group "Mandriva" --key "FileManager" --type "bool" 1 fi # We need to remove all old files from kde3 DIR=$(eval "echo $(kreadconfig --file $HOME/.config/user-dirs.dirs --key XDG_DESKTOP_DIR)" ) if [ -z $DIR ]; then DIR="$HOME/Desktop" fi if [ -e "${DIR}/media.desktop" ]; then rm -f "${DIR}/media.desktop" fi OLDICON=$(kreadconfig --group "Mandriva" --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 "Mandriva" --key "IconMigration" --type "bool" 1 fi fi