Support "certbot-auto --no-bootstrap" (#3955)

* Support "certbot-auto --no-bootstrap"

* Tell people about --no-bootstrap?

* Document new certbot-auto flag in its cli help

* Rebuild

* Less variables is less variability

* Alphabetize help

* Make it extra clear we only take one branch

* Add --no-bootstrap message to experimentalbootstrap exit
This commit is contained in:
Peter Eckersley
2017-04-04 16:12:31 -07:00
committed by GitHub
parent 43dccfc671
commit 2bdfffb23a
3 changed files with 45 additions and 16 deletions
+5
View File
@@ -952,6 +952,11 @@ def prepare_and_parse_args(plugins, args, detect_defaults=False): # pylint: dis
help="(certbot-auto only) prevent the certbot-auto script from" help="(certbot-auto only) prevent the certbot-auto script from"
" upgrading itself to newer released versions (default: Upgrade" " upgrading itself to newer released versions (default: Upgrade"
" automatically)") " automatically)")
helpful.add(
"automation", "--no-bootstrap", action="store_true",
help="(certbot-auto only) prevent the certbot-auto script from"
" installing OS-level dependencies (default: Prompt to install "
" OS-wide dependencies, but exit if the user says 'No')")
helpful.add( helpful.add(
["automation", "renew", "certonly", "run"], ["automation", "renew", "certonly", "run"],
"-q", "--quiet", dest="quiet", action="store_true", "-q", "--quiet", dest="quiet", action="store_true",
+20 -8
View File
@@ -36,6 +36,7 @@ Help for certbot itself cannot be provided until it is installed.
--debug attempt experimental installation --debug attempt experimental installation
-h, --help print this help -h, --help print this help
-n, --non-interactive, --noninteractive run without asking for user input -n, --non-interactive, --noninteractive run without asking for user input
--no-bootstrap do not install OS dependencies
--no-self-upgrade do not download updates --no-self-upgrade do not download updates
--os-packages-only install OS dependencies and exit --os-packages-only install OS dependencies and exit
-v, --verbose provide more output -v, --verbose provide more output
@@ -54,6 +55,8 @@ for arg in "$@" ; do
# Do not upgrade this script (also prevents client upgrades, because each # Do not upgrade this script (also prevents client upgrades, because each
# copy of the script pins a hash of the python client) # copy of the script pins a hash of the python client)
NO_SELF_UPGRADE=1;; NO_SELF_UPGRADE=1;;
--no-bootstrap)
NO_BOOTSTRAP=1;;
--help) --help)
HELP=1;; HELP=1;;
--noninteractive|--non-interactive) --noninteractive|--non-interactive)
@@ -160,17 +163,24 @@ else
fi fi
fi fi
BootstrapMessage() {
# Arguments: Platform name
echo "Bootstrapping dependencies for $1... (you can skip this with --no-bootstrap)"
}
ExperimentalBootstrap() { ExperimentalBootstrap() {
# Arguments: Platform name, bootstrap function name # Arguments: Platform name, bootstrap function name
if [ "$DEBUG" = 1 ]; then if [ "$DEBUG" = 1 ]; then
if [ "$2" != "" ]; then if [ "$2" != "" ]; then
echo "Bootstrapping dependencies via $1..." BootstrapMessage $1
$2 $2
fi fi
else else
echo "FATAL: $1 support is very experimental at present..." echo "FATAL: $1 support is very experimental at present..."
echo "if you would like to work on improving it, please ensure you have backups" echo "if you would like to work on improving it, please ensure you have backups"
echo "and then run this script again with the --debug flag!" echo "and then run this script again with the --debug flag!"
echo "Alternatively, you can install OS dependencies yourself and run this script"
echo "again with --no-bootstrap."
exit 1 exit 1
fi fi
} }
@@ -576,21 +586,23 @@ BootstrapMageiaCommon() {
# Install required OS packages: # Install required OS packages:
Bootstrap() { Bootstrap() {
if [ -f /etc/debian_version ]; then if [ "$NO_BOOTSTRAP" = 1 ]; then
echo "Bootstrapping dependencies for Debian-based OSes..." return
elif [ -f /etc/debian_version ]; then
BootstrapMessage "Debian-based OSes"
BootstrapDebCommon BootstrapDebCommon
elif [ -f /etc/mageia-release ] ; then elif [ -f /etc/mageia-release ]; then
# Mageia has both /etc/mageia-release and /etc/redhat-release # Mageia has both /etc/mageia-release and /etc/redhat-release
ExperimentalBootstrap "Mageia" BootstrapMageiaCommon ExperimentalBootstrap "Mageia" BootstrapMageiaCommon
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
echo "Bootstrapping dependencies for RedHat-based OSes..." BootstrapMessage "RedHat-based OSes"
BootstrapRpmCommon BootstrapRpmCommon
elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then
echo "Bootstrapping dependencies for openSUSE-based OSes..." BootstrapMessage "openSUSE-based OSes"
BootstrapSuseCommon BootstrapSuseCommon
elif [ -f /etc/arch-release ]; then elif [ -f /etc/arch-release ]; then
if [ "$DEBUG" = 1 ]; then if [ "$DEBUG" = 1 ]; then
echo "Bootstrapping dependencies for Archlinux..." BootstrapMessage "Archlinux"
BootstrapArchCommon BootstrapArchCommon
else else
echo "Please use pacman to install letsencrypt packages:" echo "Please use pacman to install letsencrypt packages:"
@@ -615,7 +627,7 @@ Bootstrap() {
else else
echo "Sorry, I don't know how to bootstrap Certbot on your operating system!" echo "Sorry, I don't know how to bootstrap Certbot on your operating system!"
echo echo
echo "You will need to bootstrap, configure virtualenv, and run pip install manually." echo "You will need to install OS dependencies, configure virtualenv, and run pip install manually."
echo "Please see https://letsencrypt.readthedocs.org/en/latest/contributing.html#prerequisites" echo "Please see https://letsencrypt.readthedocs.org/en/latest/contributing.html#prerequisites"
echo "for more info." echo "for more info."
exit 1 exit 1
@@ -36,6 +36,7 @@ Help for certbot itself cannot be provided until it is installed.
--debug attempt experimental installation --debug attempt experimental installation
-h, --help print this help -h, --help print this help
-n, --non-interactive, --noninteractive run without asking for user input -n, --non-interactive, --noninteractive run without asking for user input
--no-bootstrap do not install OS dependencies
--no-self-upgrade do not download updates --no-self-upgrade do not download updates
--os-packages-only install OS dependencies and exit --os-packages-only install OS dependencies and exit
-v, --verbose provide more output -v, --verbose provide more output
@@ -54,6 +55,8 @@ for arg in "$@" ; do
# Do not upgrade this script (also prevents client upgrades, because each # Do not upgrade this script (also prevents client upgrades, because each
# copy of the script pins a hash of the python client) # copy of the script pins a hash of the python client)
NO_SELF_UPGRADE=1;; NO_SELF_UPGRADE=1;;
--no-bootstrap)
NO_BOOTSTRAP=1;;
--help) --help)
HELP=1;; HELP=1;;
--noninteractive|--non-interactive) --noninteractive|--non-interactive)
@@ -160,17 +163,24 @@ else
fi fi
fi fi
BootstrapMessage() {
# Arguments: Platform name
echo "Bootstrapping dependencies for $1... (you can skip this with --no-bootstrap)"
}
ExperimentalBootstrap() { ExperimentalBootstrap() {
# Arguments: Platform name, bootstrap function name # Arguments: Platform name, bootstrap function name
if [ "$DEBUG" = 1 ]; then if [ "$DEBUG" = 1 ]; then
if [ "$2" != "" ]; then if [ "$2" != "" ]; then
echo "Bootstrapping dependencies via $1..." BootstrapMessage $1
$2 $2
fi fi
else else
echo "FATAL: $1 support is very experimental at present..." echo "FATAL: $1 support is very experimental at present..."
echo "if you would like to work on improving it, please ensure you have backups" echo "if you would like to work on improving it, please ensure you have backups"
echo "and then run this script again with the --debug flag!" echo "and then run this script again with the --debug flag!"
echo "Alternatively, you can install OS dependencies yourself and run this script"
echo "again with --no-bootstrap."
exit 1 exit 1
fi fi
} }
@@ -206,21 +216,23 @@ DeterminePythonVersion() {
# Install required OS packages: # Install required OS packages:
Bootstrap() { Bootstrap() {
if [ -f /etc/debian_version ]; then if [ "$NO_BOOTSTRAP" = 1 ]; then
echo "Bootstrapping dependencies for Debian-based OSes..." return
elif [ -f /etc/debian_version ]; then
BootstrapMessage "Debian-based OSes"
BootstrapDebCommon BootstrapDebCommon
elif [ -f /etc/mageia-release ] ; then elif [ -f /etc/mageia-release ]; then
# Mageia has both /etc/mageia-release and /etc/redhat-release # Mageia has both /etc/mageia-release and /etc/redhat-release
ExperimentalBootstrap "Mageia" BootstrapMageiaCommon ExperimentalBootstrap "Mageia" BootstrapMageiaCommon
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
echo "Bootstrapping dependencies for RedHat-based OSes..." BootstrapMessage "RedHat-based OSes"
BootstrapRpmCommon BootstrapRpmCommon
elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then elif [ -f /etc/os-release ] && `grep -q openSUSE /etc/os-release` ; then
echo "Bootstrapping dependencies for openSUSE-based OSes..." BootstrapMessage "openSUSE-based OSes"
BootstrapSuseCommon BootstrapSuseCommon
elif [ -f /etc/arch-release ]; then elif [ -f /etc/arch-release ]; then
if [ "$DEBUG" = 1 ]; then if [ "$DEBUG" = 1 ]; then
echo "Bootstrapping dependencies for Archlinux..." BootstrapMessage "Archlinux"
BootstrapArchCommon BootstrapArchCommon
else else
echo "Please use pacman to install letsencrypt packages:" echo "Please use pacman to install letsencrypt packages:"
@@ -245,7 +257,7 @@ Bootstrap() {
else else
echo "Sorry, I don't know how to bootstrap Certbot on your operating system!" echo "Sorry, I don't know how to bootstrap Certbot on your operating system!"
echo echo
echo "You will need to bootstrap, configure virtualenv, and run pip install manually." echo "You will need to install OS dependencies, configure virtualenv, and run pip install manually."
echo "Please see https://letsencrypt.readthedocs.org/en/latest/contributing.html#prerequisites" echo "Please see https://letsencrypt.readthedocs.org/en/latest/contributing.html#prerequisites"
echo "for more info." echo "for more info."
exit 1 exit 1