Clarify booleans

pull/8/head
Bohan Yang 5 years ago committed by GitHub
parent 7f01579392
commit 2854ef93dc
  1. 6
      README.md
  2. 24
      debi.sh

@ -44,14 +44,14 @@ This script is written to reinstall a VPS/virtual machine to Debian 10 Buster.
* `--mirror-host deb.debian.org` * `--mirror-host deb.debian.org`
* `--mirror-directory /debian` * `--mirror-directory /debian`
* `--security-repository http://security.debian.org/debian-security` Magic value: `'mirror' = <mirror-protocol>://<mirror-host>/<mirror-directory>/../debian-security` * `--security-repository http://security.debian.org/debian-security` Magic value: `'mirror' = <mirror-protocol>://<mirror-host>/<mirror-directory>/../debian-security`
* `--skip-account-setup` * `--no-account-setup, --no-user`
* `--username debian` New user with `sudo` privilege or `root` * `--username, --user debian` New user with `sudo` privilege or `root`
* `--password <string>` Password of the new user. **You'll be prompted if you choose to not specify it here** * `--password <string>` Password of the new user. **You'll be prompted if you choose to not specify it here**
* `--authorized-keys-url <string>` URL to your authorized keys for SSH authentication. e.g. `https://github.com/torvalds.keys` * `--authorized-keys-url <string>` URL to your authorized keys for SSH authentication. e.g. `https://github.com/torvalds.keys`
* `--sudo-with-password` Require password when the user invokes `sudo` command * `--sudo-with-password` Require password when the user invokes `sudo` command
* `--timezone UTC` https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List * `--timezone UTC` https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
* `--ntp 0.debian.pool.ntp.org` * `--ntp 0.debian.pool.ntp.org`
* `--skip-partitioning` * `--no-disk-partitioning, --no-part`
* `--disk <string>` Manually select a disk for installation. **Please remember to specify this when more than one disk is available!** e.g. `/dev/sda` * `--disk <string>` Manually select a disk for installation. **Please remember to specify this when more than one disk is available!** e.g. `/dev/sda`
* `--no-force-gpt` By default, GPT rather than MBR partition table will be created. This option disables it. * `--no-force-gpt` By default, GPT rather than MBR partition table will be created. This option disables it.
* `--bios` Don't create *EFI system partition*. If GPT is being used, create a *BIOS boot partition* (`bios_grub` partition). Default if `/sys/firmware/efi` is absent. [See](https://askubuntu.com/a/501360) * `--bios` Don't create *EFI system partition*. If GPT is being used, create a *BIOS boot partition* (`bios_grub` partition). Default if `/sys/firmware/efi` is absent. [See](https://askubuntu.com/a/501360)

@ -63,14 +63,14 @@ mirror_protocol=http
mirror_host=deb.debian.org mirror_host=deb.debian.org
mirror_directory=/debian mirror_directory=/debian
security_repository=http://security.debian.org/debian-security security_repository=http://security.debian.org/debian-security
skip_account_setup=false account_setup=true
username=debian username=debian
password= password=
authorized_keys_url= authorized_keys_url=
sudo_with_password=false sudo_with_password=false
timezone=UTC timezone=UTC
ntp=0.debian.pool.ntp.org ntp=0.debian.pool.ntp.org
skip_partitioning=false disk_partitioning=true
disk= disk=
force_gpt=true force_gpt=true
efi= efi=
@ -150,8 +150,8 @@ while [ $# -gt 0 ]; do
security_repository=$2 security_repository=$2
shift shift
;; ;;
--skip-account-setup) --no-user|--no-account-setup)
skip_account_setup=true account_setup=false
;; ;;
--user|--username) --user|--username)
username=$2 username=$2
@ -176,8 +176,8 @@ while [ $# -gt 0 ]; do
ntp=$2 ntp=$2
shift shift
;; ;;
--skip-partitioning) --no-part|--no-disk-partitioning)
skip_partitioning=true disk_partitioning=false
;; ;;
--disk) --disk)
disk=$2 disk=$2
@ -260,14 +260,14 @@ done
installer="debian-$suite" installer="debian-$suite"
installer_directory="/boot/$installer" installer_directory="/boot/$installer"
if [ "$skip_account_setup" = false ]; then if [ "$account_setup" = true ]; then
prompt_password prompt_password
elif [ "$network_console" = true ] && [ -z "$authorized_keys_url" ]; then elif [ "$network_console" = true ] && [ -z "$authorized_keys_url" ]; then
prompt_password "Choose a password for the installer user of the SSH network console: " prompt_password "Choose a password for the installer user of the SSH network console: "
fi fi
save_preseed='cat' save_preseed='cat'
if [ "$dry_run" != true ]; then if [ "$dry_run" = false ]; then
[ "$(id -u)" -ne 0 ] && err 'root privilege is required' [ "$(id -u)" -ne 0 ] && err 'root privilege is required'
rm -rf "$installer_directory" rm -rf "$installer_directory"
mkdir -p "$installer_directory/initrd" mkdir -p "$installer_directory/initrd"
@ -351,7 +351,7 @@ d-i mirror/suite string $suite
d-i mirror/udeb/suite string $suite d-i mirror/udeb/suite string $suite
EOF EOF
if [ "$skip_account_setup" != true ]; then if [ "$account_setup" = true ]; then
password_hash= password_hash=
if command_exists mkpasswd; then if command_exists mkpasswd; then
password_hash=$(mkpasswd -m sha-512 "$password") password_hash=$(mkpasswd -m sha-512 "$password")
@ -431,7 +431,7 @@ d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string $ntp d-i clock-setup/ntp-server string $ntp
EOF EOF
if [ "$skip_partitioning" != true ]; then if [ "$disk_partitioning" = true ]; then
$save_preseed << 'EOF' $save_preseed << 'EOF'
# Partitioning # Partitioning
@ -538,7 +538,7 @@ $save_preseed << 'EOF'
EOF EOF
[ "$hold" != true ] && echo 'd-i finish-install/reboot_in_progress note' | $save_preseed [ "$hold" = false ] && echo 'd-i finish-install/reboot_in_progress note' | $save_preseed
[ "$bbr" = true ] && late_command '{ echo "net.core.default_qdisc=fq"; echo "net.ipv4.tcp_congestion_control=bbr"; } > /etc/sysctl.d/bbr.conf' [ "$bbr" = true ] && late_command '{ echo "net.core.default_qdisc=fq"; echo "net.ipv4.tcp_congestion_control=bbr"; } > /etc/sysctl.d/bbr.conf'
@ -547,7 +547,7 @@ EOF
[ "$power_off" = true ] && echo 'd-i debian-installer/exit/poweroff boolean true' | $save_preseed [ "$power_off" = true ] && echo 'd-i debian-installer/exit/poweroff boolean true' | $save_preseed
save_grub_cfg='cat' save_grub_cfg='cat'
if [ "$dry_run" != true ]; then if [ "$dry_run" = false ]; then
if [ -z "$architecture" ]; then if [ -z "$architecture" ]; then
architecture=amd64 architecture=amd64
command_exists dpkg && architecture=$(dpkg --print-architecture) command_exists dpkg && architecture=$(dpkg --print-architecture)

Loading…
Cancel
Save