mirror of
https://github.com/imapsync/imapsync.git
synced 2025-06-12 23:44:52 +02:00
36 lines
1.1 KiB
Bash
Executable file
36 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# $Id: backup_old_dist,v 1.4 2017/10/22 14:28:37 gilles Exp gilles $
|
|
|
|
# Bye on any error not handled
|
|
set -e
|
|
|
|
DIST_PATH=${1:-dist}
|
|
|
|
echo $DIST_PATH
|
|
|
|
! test -f $DIST_PATH/imapsync && return
|
|
|
|
version_previous=`$DIST_PATH/imapsync --version || echo ERROR`
|
|
echo "previous: [$version_previous]"
|
|
|
|
test "ERROR" != "$version_previous" || return 1
|
|
|
|
version_current=`cat VERSION || echo ERROR`
|
|
|
|
test "ERROR" != "$version_current" || return 1
|
|
|
|
echo "current: [$version_current]"
|
|
|
|
# nothing to backup
|
|
test "$version_previous" = "$version_current" && { echo "Nothing to backup, same release: $version_previous == $version_current" ; return 0 ; }
|
|
|
|
test -d $DIST_PATH/old_releases/$version_previous || mkdir $DIST_PATH/old_releases/$version_previous && ( cd $DIST_PATH/old_releases/$version_previous )
|
|
|
|
pwd
|
|
# all or nothing
|
|
ls -ld $DIST_PATH/imapsync $DIST_PATH/imapsync-$version_previous.tgz $DIST_PATH/imapsync_$version_previous.zip || return 1
|
|
# let's do it
|
|
mv -vf $DIST_PATH/imapsync $DIST_PATH/imapsync_bin_Darwin $DIST_PATH/imapsync-$version_previous.tgz $DIST_PATH/imapsync_$version_previous.zip $DIST_PATH/old_releases/$version_previous
|
|
|
|
|