]> arthur.barton.de Git - ansible-collection-boilerplate.git/commitdiff
ansible-boilerplate: Only create ".new" files when called with the "init" subcommand
authorAlexander Barton <alex@barton.de>
Thu, 20 Jul 2023 09:04:26 +0000 (11:04 +0200)
committerAlexander Barton <alex@barton.de>
Thu, 20 Jul 2023 09:04:26 +0000 (11:04 +0200)
Don't create ".new" files on "upgrade"!

bin/ansible-boilerplate

index 9d5fc213024fb9da4adeff4bc0ea104d113595fb..3d089a189c9f1c3a0eed7dabdcb9917c740ffdf7 100755 (executable)
@@ -261,7 +261,7 @@ Upgrade_Template() {
        # Do not override the target when it exists already!
        if [ -e "$1" ]; then
                # Target already exists. Is it different?
-               if ! cmp "$1" "${BASE_D}/$1"; then
+               if [ "$2" = "--init" ] && ! cmp "$1" "${BASE_D}/$1"; then
                        # Files are not the same! Install new version in parallel:
                        install -b -m 0644 -p -v "${BASE_D}/$1" "$1.new"
                fi