add messaging and exit earlier

This commit is contained in:
ander 2021-07-07 21:28:00 +03:00
parent 7a5896acfa
commit cf0032d667
No known key found for this signature in database
GPG key ID: 0A2971E562D618F3

View file

@ -27,27 +27,31 @@ then
sed_cmd="$sed_cmd --regexp-extended"
fi
if ! echo "$script" \
if echo "$script" \
| "$sed_cmd" -f - "$file_from_target" \
| diff "$file_from_target" - \
> /dev/null
then
# shellcheck disable=SC2016
echo 'tmp="$( mktemp )"'
echo "$sed_cmd -f - '$file' > \"\$tmp\" << EOF"
echo "$script"
echo 'EOF'
echo "cp \"\$tmp\" '$file'"
# shellcheck disable=SC2016
echo 'rm -f "$tmp"'
if [ -f "$__object/parameter/onchange" ]
then
cat "$__object/parameter/onchange"
fi
exit 0
fi
# shellcheck disable=SC2016
echo 'tmp="$( mktemp )"'
echo "$sed_cmd -f - '$file' > \"\$tmp\" << EOF"
echo "$script"
echo 'EOF'
echo "cp \"\$tmp\" '$file'"
# shellcheck disable=SC2016
echo 'rm -f "$tmp"'
echo 'change' >> "$__messages_out"
if [ -f "$__object/parameter/onchange" ]
then
cat "$__object/parameter/onchange"
fi