Commit a5d276ac authored by Xu Wang's avatar Xu Wang
Browse files

fix git-crypt-unlock-all.sh, unlock current repo first before unlock submodules

parent 5b6111e7
Pipeline #315 skipped
......@@ -33,6 +33,22 @@ function verify_gpg_passphrase() {
done
}
function do_unlock() {
echo unlock $PWD
keyfile=$1
if [ ! -z $keyfile ];
then
git-crypt unlock $keyfile
else
expect <<EOF
spawn git-crypt unlock
expect "Enter passphrase:"
send "$passphrase\r";
expect eof
EOF
fi
}
# MAIN
keyfile=${1:-''}
if [ -z $keyfile ];
......@@ -43,6 +59,10 @@ else
[ ! -f $keyfile ] && abort "unable to read $keyfile."
fi
# unlock current repo
do_unlock $keyfile
# unlock submodules
modules=$(git submodule status)
[ -z "$modules" ] && abort "No submodules"
......@@ -57,17 +77,7 @@ do
( echo "Checking out $i master branch"
cd $m
git checkout master
if [ ! -z $keyfile ];
then
git-crypt unlock $keyfile
else
expect <<EOF
spawn git-crypt unlock
expect "Enter passphrase:"
send "$passphrase\r";
expect eof
EOF
fi
do_unlock $keyfile
)
fi
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment