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:11:36 -07:00
|
|
|
ZIPURL="https://github.com/letsencrypt/letsencrypt/archive/master.zip"
|
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:"
|
2016-02-27 15:14:45 -07:00
|
|
|
echo "-g : download using git from master repo (recommended)"
|
2016-02-27 15:07:25 -07:00
|
|
|
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:13:37 -07:00
|
|
|
curl -L -o letsencrypt-master.zip ${ZIPURL}
|
|
|
|
unzip -q letsencrypt-master.zip
|
|
|
|
mv letsencrypt-master letsencrypt
|
2016-02-27 15:07:25 -07:00
|
|
|
;;
|
2016-02-27 15:01:13 -07:00
|
|
|
esac
|