-#! /bin/bash
+#!/bin/sh
## @file
## This needs to be run only when the menus have changed.
##
-tmp_file=$(mktemp)
+tmp_file=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
path=$(dirname "$(realpath "$0")")
-srcpath=$(dirname "$path")/src/layout_util.c
-templatepath=$(dirname "$path")/plugins/template.desktop.in
+srcpath=$(dirname "$path")/src/ui/menu-classic.ui
+templatepath=$(dirname "$path")/plugins/org.geeqie.template.desktop.in
awk -v src_path="$srcpath" 'BEGIN {
menu_flag = 0
{
{while ((getline line < src_path) > 0 )
{
- if (line == "\"<ui>\"")
+ if (line == "<ui>")
{
menu_flag = 1
}
- if (line == "\"<\057ui>\";")
+ if (line == "<\047ui>")
{
menu_flag = 0
}
{
i = i - 1
}
+ if (lineArr[2] == "PluginsMenu")
+ {
+ i = i - 1
+ }
}
}
}
}
/Valid sections/ {template_flag = 1; print; get_menus()}
-/This is a filter/ {template_flag = 0; print ""}
+/For other keys/ {template_flag = 0; print ""}
(template_flag == 0) {print}
' "$templatepath" > "$tmp_file"
-cat $tmp_file
-echo $PWD
-
-diff --unified=0 "./plugins/template.desktop.in" "$tmp_file" | zenity --title="Plugin template update" --text-info --width=700 --height=400
+cat "$tmp_file"
+printf '%s\n' "$PWD"
-if [ "$?" == 0 ]
+if diff --unified=0 "./plugins/org.geeqie.template.desktop.in" "$tmp_file" | zenity --title="Plugin template update" --text-info --width=700 --height=400
then
mv "$tmp_file" "$templatepath"
else