Skip to content

Instantly share code, notes, and snippets.

@csirac2
Last active June 8, 2021 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csirac2/4660a3d9ee37d3a78528 to your computer and use it in GitHub Desktop.
Save csirac2/4660a3d9ee37d3a78528 to your computer and use it in GitHub Desktop.
Install VeraCrypt headless for scripted environments
#!/bin/sh
# It's a little insane this installer cannot be run headless, perhaps for license
# agreement reasons. This will fetch, verify and extract the binary into
# /opt/veracrypt/bin. Perhaps one day I'll help make cryptsetup understand
# veracrypt instead
set -e
VERATARURL='http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=veracrypt&DownloadId=1372347&FileTime=130649793702230000&Build=20959'
VERASIGURL='http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=veracrypt&DownloadId=1372354&FileTime=130649793743570000&Build=20959'
VERASIGID=54DDD393
VERABIN=veracrypt-1.0f-1-setup-console-x64
VERATMP=$(mktemp -d)
VERAINST=/opt/veracrypt
mkdir -pv $VERAINST
## If you're YOLO enough to script the key import, uncomment these lines below:
# gpg --list-keys "$VERASIGID" || \
# wget -q https://www.idrix.fr/VeraCrypt/VeraCrypt_PGP_public_key.asc -O - | \
# gpg --import -
gpg --list-keys "$VERASIGID" || exit 1
test -f veracrypt-setup.tar.bz2 || \
wget --no-clobber -O veracrypt-setup.tar.bz2 "$VERATARURL"
test -f veracrypt-setup.sig || \
wget --no-clobber -O veracrypt-setup.sig "$VERASIGURL"
gpg --verify veracrypt-setup.sig veracrypt-setup.tar.bz2 || exit 1
mkdir -p $VERATMP/installer
tar -xf veracrypt-setup.tar.bz2 -C $VERATMP
$VERATMP/$VERABIN --nox11 --noexec --target $VERATMP/installer/
VERASTART=$(sed -n 's/.*PACKAGE_START=\([0-9]*\).*/\1/p' $VERATMP/installer/*)
tail -n +$VERASTART $VERATMP/installer/* > $VERATMP/installer.tar
tar -xf $VERATMP/installer.tar --strip-components 1 -C $VERAINST
test -n "$VERATMP" && test -d "$VERATMP" && rm -rvf $VERATMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment