Skip to content

Instantly share code, notes, and snippets.

@kelvan
Last active July 22, 2016 22:05
Show Gist options
  • Save kelvan/8457fe760852359b05d4a495bad9ce75 to your computer and use it in GitHub Desktop.
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
#!/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"
@xoquox
Copy link

xoquox commented Jul 22, 2016

Nice Script, thanks!
But I had to change "#!/bin/sh" to "#!/bin/bash" to make it work on my debian machine.

@kelvan
Copy link
Author

kelvan commented Jul 22, 2016

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