ast_coredumper: Minor fixes
authorGeorge Joseph <gjoseph@digium.com>
Fri, 23 Feb 2018 20:58:54 +0000 (13:58 -0700)
committerGeorge Joseph <gjoseph@digium.com>
Fri, 23 Feb 2018 21:01:18 +0000 (15:01 -0600)
* Fix --tarball-config so the option doesn't cause an error.

* Allow for missing /etc/os-release.

* Add a sleep between tarballing the coredump and removing the
  output directory to allow the filesystem to settle.

Change-Id: I73e03b13087978bcc7f6bc9f45753990f82d9d77

contrib/scripts/ast_coredumper

index 884ede7..38d95cc 100755 (executable)
@@ -216,6 +216,7 @@ running=false
 RUNNING=false
 latest=false
 tarball_coredumps=false
+tarball_config=false
 delete_coredumps_after=false
 tarball_results=false
 delete_results_after=false
@@ -281,6 +282,9 @@ for a in "$@" ; do
        --tarball-coredumps)
                tarball_coredumps=true
                ;;
+       --tarball-config)
+               tarball_config=true
+               ;;
        --delete-coredumps-after)
                delete_coredumps_after=true
                ;;
@@ -436,7 +440,7 @@ for i in ${!COREDUMPS[@]} ; do
 
                ln -s ${cf} ${dest}/tmp/${cfname}
                cp ${outputdir}/${cfname}*.txt ${dest}/tmp/
-               cp /etc/os-release ${dest}/etc/
+               [ -f /etc/os-release ] && cp /etc/os-release ${dest}/etc/
                if $tarball_config ; then
                        cp -a /etc/asterisk ${dest}/etc/
                fi
@@ -445,6 +449,7 @@ for i in ${!COREDUMPS[@]} ; do
                cp -a /usr/sbin/asterisk ${dest}/usr/sbin
                rm -rf ${tf}
                tar -chzf ${tf} --transform="s/^[.]/${cfname}/" -C ${dest} .
+               sleep 3
                rm -rf ${dest}
                echo "Created $tf"
        elif $tarball_results ; then