-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.4.6-upgrade-fix-xfce4-config.bash
executable file
·30 lines (27 loc) · 1.54 KB
/
1.4.6-upgrade-fix-xfce4-config.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# This script updates references to this plugin of 'hardware-monitor' with 'xfce4-hardware-monitor-plugin' to be ran after the v1.4.6 upgrade
# Rename plugin configuration files
OIFS="$IFS"
IFS=$'\n'
for filename in $(ls -1 ~/.config/xfce4/panel)
do
[[ $filename =~ ^hardware-monitor-([[:digit:]]+)\.rc$ ]] && {
mv ~/".config/xfce4/panel/$filename" ~/".config/xfce4/panel/xfce4-hardware-monitor-plugin-${BASH_REMATCH[1]}.rc" || echo "Unable to rename '$filename' plugin configuration file!" >&2
}
done
IFS="$OIFS"
# Update panel config
echo "Creating panel config backup at '~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml.bak'..."
cp ~/".config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml" ~/".config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml.bak" || {
echo "Backup creation failed!" >&2
exit 1
}
sed 's/value="hardware-monitor"/value="xfce4-hardware-monitor-plugin"/g' ~/".config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml" > ~/".config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml.modified" || {
echo "Unable to update panel config!" >&2
exit 1
}
mv -f ~/".config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml.modified" ~/".config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml" || {
echo "Unable to replace old panel config with new one!" >&2
exit 1
}
echo "XFCE4 configuration has been updated - please log out now and back in again - once you've confirmed the change has worked, please delete the backup file '~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml.bak'"