mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 00:24:35 +02:00
Add build script for letsencrypt-auto.
Change template language to reference files, saving me some boilerplate over the dict-based .format() thing I originally had in mind. Put newlines at the ends of bootstrap scripts. It makes the built le-auto script prettier.
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python
|
||||
"""Stitch together the letsencrypt-auto script.
|
||||
|
||||
Implement a simple templating language in which {{ some/file }} turns into the
|
||||
contents of the file at ./pieces/some/file.
|
||||
|
||||
"""
|
||||
from os.path import dirname, join
|
||||
import re
|
||||
from sys import argv
|
||||
|
||||
|
||||
def main():
|
||||
dir = dirname(argv[0])
|
||||
|
||||
def replacer(match):
|
||||
rel_path = match.group(1)
|
||||
with open(join(dir, 'pieces', rel_path)) as replacement:
|
||||
return replacement.read()
|
||||
|
||||
with open(join(dir, 'letsencrypt-auto.template')) as template:
|
||||
result = re.sub(r'{{\s*([A-Za-z0-9_./-]+)\s*}}',
|
||||
replacer,
|
||||
template.read())
|
||||
with open(join(dir, 'letsencrypt-auto'), 'w') as out:
|
||||
out.write(result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -49,13 +49,13 @@ DeterminePythonVersion() {
|
||||
fi
|
||||
}
|
||||
|
||||
{{bootstrap_deb_common}}
|
||||
{{bootstrap_rpm_common}}
|
||||
{{bootstrap_suse_common}}
|
||||
{{bootstrap_arch_common}}
|
||||
{{bootstrap_gentoo_common}}
|
||||
{{bootstrap_free_bsd}}
|
||||
{{bootstrap_mac}}
|
||||
{{ bootstrappers/deb_common.sh }}
|
||||
{{ bootstrappers/rpm_common.sh }}
|
||||
{{ bootstrappers/suse_common.sh }}
|
||||
{{ bootstrappers/arch_common.sh }}
|
||||
{{ bootstrappers/gentoo_common.sh }}
|
||||
{{ bootstrappers/free_bsd.sh }}
|
||||
{{ bootstrappers/mac.sh }}
|
||||
|
||||
# Install required OS packages:
|
||||
Bootstrap() {
|
||||
@@ -180,7 +180,7 @@ elif [ "$1" != "--_skip-to-install" ]; then
|
||||
# There is no $ interpolation due to quotes on heredoc delimiters.
|
||||
set +e
|
||||
TEMP_DIR=`$PYTHON - << "UNLIKELY_EOF"
|
||||
{{download_upgrade}}
|
||||
{{ download_upgrade.py }}
|
||||
UNLIKELY_EOF`
|
||||
DOWNLOAD_STATUS=$?
|
||||
set -e
|
||||
@@ -205,11 +205,11 @@ else # --_skip-to-install was passed.
|
||||
TEMP_DIR="$2"
|
||||
shift 2
|
||||
cat << "UNLIKELY_EOF" > $TEMP_DIR/letsencrypt-auto-requirements.txt
|
||||
{{requirements}}
|
||||
{{ letsencrypt-auto-requirements.txt }}
|
||||
UNLIKELY_EOF
|
||||
|
||||
cat << "UNLIKELY_EOF" > $TEMP_DIR/peep.py
|
||||
{{peep}}
|
||||
{{ peep.py }}
|
||||
UNLIKELY_EOF
|
||||
|
||||
set +e
|
||||
|
||||
@@ -24,4 +24,4 @@ BootstrapArchCommon() {
|
||||
if [ "$missing" ]; then
|
||||
"$SUDO" pacman -S --needed $missing
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,4 +5,4 @@ BootstrapFreeBsd() {
|
||||
py27-virtualenv \
|
||||
augeas \
|
||||
libffi \
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,4 @@ BootstrapGentooCommon() {
|
||||
"$SUDO" emerge --noreplace $PACKAGES
|
||||
;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,4 +16,4 @@ BootstrapMac() {
|
||||
echo "virtualenv Not Installed\nInstalling with pip"
|
||||
pip install virtualenv
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,4 @@ BootstrapRpmCommon() {
|
||||
echo "Could not install additional dependencies. Aborting bootstrap!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,4 @@ BootstrapSuseCommon() {
|
||||
libopenssl-devel \
|
||||
libffi-devel \
|
||||
ca-certificates \
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user