Last active
July 22, 2016 22:05
-
-
Save kelvan/8457fe760852359b05d4a495bad9ce75 to your computer and use it in GitHub Desktop.
Script to convert Jolla1 vault (backup) to JollaC version, either on device or using a Backup.tar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
DATE_STRING=`date -u "+%Y-%m-%dT%H-%M-%SZ"` | |
TMP_PATH=$HOME/vault_tmp_$DATE_STRING | |
TARGET_ARCHIVE=$HOME/sailfish_backup_$DATE_STRING.tar | |
FOLDERS="Accounts Browser Gallery Media Messages Notes People Phone" | |
if [ -n "$1" ]; then | |
VAULT_PATH=$TMP_PATH/.vault | |
else | |
VAULT_PATH=$HOME/.vault | |
if [ ! -d $VAULT_PATH ]; then | |
echo ".vault not found in home"; | |
echo "run on Jolla1 or provide path to Backup.tar"; | |
exit 1; | |
fi | |
fi | |
mkdir -p $TMP_PATH/vault/ | |
mkdir $TMP_PATH/old_backup/ | |
tar xf $1 -C $TMP_PATH/old_backup/ | |
pushd $TMP_PATH/ > /dev/null | |
git clone old_backup $VAULT_PATH | |
ln -s $TMP_PATH/old_backup/.git/blobs $VAULT_PATH/.git/blobs | |
for folder in $FOLDERS | |
do | |
if [ -d $VAULT_PATH/$folder ]; then | |
cp -Lr $VAULT_PATH/$folder $TMP_PATH/vault/ | |
fi | |
done | |
tar cf $TARGET_ARCHIVE --transform "s#\(.*\)#tmp/vault/\1#g" vault/ | |
rm -rf $TMP_PATH | |
popd > /dev/null | |
echo "backup archive written to $TARGET_ARCHIVE" |
thanks for the feedback, changed it to bash for now
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice Script, thanks!
But I had to change "#!/bin/sh" to "#!/bin/bash" to make it work on my debian machine.