Browse Source

Rename "<Filename>kde-" in the menu only if the original file is not preserved.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/140/head
Slávek Banko 7 months ago
parent
commit
2d8b5af506
No known key found for this signature in database GPG Key ID: 608F5293A04BE668
1 changed files with 13 additions and 6 deletions
  1. +13
    -6
      r14-xdg-update

+ 13
- 6
r14-xdg-update View File

@@ -887,14 +887,21 @@ fi
if [ "$R14_VERSION" -lt "202004080" ]; then
# Update the user's custom menu. Any custom menu should have been renamed a few lines above.
if [ -r $USER_DIR/.config/menus/applications-tdemenuedit.menu ]; then
grep "<Filename>kde-" "$USER_DIR/.config/menus/applications-tdemenuedit.menu" > "${CACHE_DIR}/${SCRIPT_NAME}-tdemenu-rename.txt" 2>&1
sed -i 's|<Filename>kde-|<Filename>tde-|g' $USER_DIR/.config/menus/applications-tdemenuedit.menu
cat "${CACHE_DIR}/${SCRIPT_NAME}-tdemenu-rename.txt" | sed -n "s|^\s*<Filename>kde-\(.*\)<\/Filename>\s*$|\1|p" | \
sed -n "s|^\s*<Filename>kde-\(.*\)<\/Filename>\s*$|\1|p" \
< "$USER_DIR/.config/menus/applications-tdemenuedit.menu" \
> "${CACHE_DIR}/${SCRIPT_NAME}-tdemenu-rename.txt"
cat "${CACHE_DIR}/${SCRIPT_NAME}-tdemenu-rename.txt" | \
while read kde_filename; do
if [ -f "$USER_DIR/.local/share/applications/kde-$kde_filename" ] && \
[ ! -f "$USER_DIR/.local/share/applications/tde-$kde_filename" ]; then
mv "$USER_DIR/.local/share/applications/kde-$kde_filename" "$USER_DIR/.local/share/applications/tde-$kde_filename"
if [ -f "$USER_DIR/.local/share/applications/kde-$kde_filename" ]; then
if [ -f "$USER_DIR/.local/share/applications/tde-$kde_filename" ]; then
continue
else
mv "$USER_DIR/.local/share/applications/kde-$kde_filename" \
"$USER_DIR/.local/share/applications/tde-$kde_filename"
fi
fi
sed -i 's|<Filename>kde-$kde_filename|<Filename>tde-$kde_filename|g' \
$USER_DIR/.config/menus/applications-tdemenuedit.menu
done
rm "${CACHE_DIR}/${SCRIPT_NAME}-tdemenu-rename.txt"
fi


Loading…
Cancel
Save