~cyplo/dotfiles

ref: 83ddcc09dc68389b129d598722eca9e90a6dff33 dotfiles/tools/deescalate.sh -rwxr-xr-x 805 bytes
83ddcc09 — Cyryl Płotnicki remove broken i3 msg call 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

set -e

vaults_directory=~/vaults/
resolved_directory=$vaults_directory/resolved
target_vault="$vaults_directory/vault.vera"
target_mount="/tmp/target_vault"
conflicted_mount=/tmp/conflicted_vault

mkdir -p $resolved_directory

umount-vault

conflicted=`find "$vaults_directory" -maxdepth 1 -iname "*vault*sync-conflict*"`
read -s -p "password: " vault_password
echo

for current_vault in $conflicted; do
    echo
    VAULT_PASSWORD="$vault_password" mount-vault $current_vault "$conflicted_mount"
    VAULT_PASSWORD="$vault_password" mount-vault $target_vault $target_mount
   
    cd $target_mount
    hg pull $conflicted_mount

    cd $vaults_directory
    umount-vault
    rm -fr "$conflicted_mount"
    mv $current_vault $resolved_directory
done

mkdir -p $vaults_directory/deescalated