lets-encrypt-scripts/get-letsencrypt.sh

46 lines
977 B
Bash
Raw Normal View History

2016-02-27 15:01:13 -07:00
#!/usr/bin/env bash
# Install LetsEncrypt official client on UNIX/Linux using a bash script.
# v1.0 - 02/27/2016
# By Brielle Bruns <bruns@2mbit.com>
# http://www.sosdg.org
# Use like: gen-letsencrypt.sh -g
#
# Flags:
# -g - use git to download
# -t - download master tarball
# Where to store the LetsEncrypt package
DESTDIR="/usr/src/"
2016-02-27 15:10:32 -07:00
ZIPURL="https://codeload.github.com/letsencrypt/letsencrypt/zip/master"
2016-02-27 15:01:13 -07:00
GITREPO="https://github.com/letsencrypt/letsencrypt"
if [ $# -eq 0 ]; then
2016-02-27 15:07:25 -07:00
echo "Command Help:"
echo "-g : download using git from master repo"
echo "-z : download zip from main repo and extract"
2016-02-27 15:01:13 -07:00
exit 0
fi
2016-02-27 15:07:25 -07:00
while getopts "gz" opt; do
2016-02-27 15:01:13 -07:00
case $opt in
g) downloadtype="git";;
2016-02-27 15:07:25 -07:00
z) downloadtype="zip";;
2016-02-27 15:01:13 -07:00
esac
done
cd ${DESTDIR}
case $downloadtype in
git)
2016-02-27 15:07:25 -07:00
echo "Cloning repo into ${DESTDIR}..."
2016-02-27 15:01:13 -07:00
git clone ${GITREPO}
;;
2016-02-27 15:08:51 -07:00
zip)
2016-02-27 15:08:29 -07:00
echo "Downloading ${ZIPURL} into ${DESTDIR}"
2016-02-27 15:01:13 -07:00
curl -o letsencrypt.zip ${ZIPURL}
unzip letsencrypt.zip
2016-02-27 15:07:25 -07:00
;;
2016-02-27 15:01:13 -07:00
esac