Browse Source

Update (big change)

Bohan Yang 7 years ago
parent
commit
42a02286d5
2 changed files with 231 additions and 237 deletions
  1. 48 39
      README.md
  2. 183 198
      netboot.sh

+ 48 - 39
README.md

@@ -2,10 +2,10 @@
 
 
 ## Step 1. Preparation
 ## Step 1. Preparation
 
 
- - A clean normally running true virtualization (e.g. KVM) VPS with GRUB2 and VNC access. This script have been tested on SolusVM KVM VPS & Alibaba Cloud ECS with Debian 8/9 & Ubuntu 16.04/18.04.
+ - A clean normally running true virtualization (e.g. KVM) VPS with GRUB 2 and VNC access. This script have been tested on SolusVM KVM VPS & Alibaba Cloud ECS with Debian 9 & Ubuntu 16.04.
  - Then check `/etc/default/grub` with your preferred editor (e.g. `nano` or `vi`).
  - Then check `/etc/default/grub` with your preferred editor (e.g. `nano` or `vi`).
  - Set `GRUB_DEFAULT` to `debian-netboot-installer` select the installer to boot automatically after timeout.
  - Set `GRUB_DEFAULT` to `debian-netboot-installer` select the installer to boot automatically after timeout.
- - Make sure there's reasonable number for `GRUB_TIMEOUT` **timeout**. You can just set `GRUB_TIMEOUT=30` which will be fine.
+ - Make sure there's reasonable number for `GRUB_TIMEOUT` **timeout**. You can just set `GRUB_TIMEOUT=10` which will be fine.
  - Make sure there's **no** `GRUB_HIDDEN_TIMEOUT_QUIET` and `GRUB_HIDDEN_TIMEOUT`. **Just delete them.**
  - Make sure there's **no** `GRUB_HIDDEN_TIMEOUT_QUIET` and `GRUB_HIDDEN_TIMEOUT`. **Just delete them.**
 
 
 Install dependencies:
 Install dependencies:
@@ -22,46 +22,55 @@ Replace following `<OPTIONS>` with your options.
 sudo sh -c "$(wget -qO- https://github.com/brentybh/debian-netboot/raw/master/netboot.sh)" -- <OPTIONS>
 sudo sh -c "$(wget -qO- https://github.com/brentybh/debian-netboot/raw/master/netboot.sh)" -- <OPTIONS>
 ```
 ```
 
 
-**Remember** to enter your current user's password for `sudo` (if need) and then enter the new user's password (if not specified by `-p`).
+**Remember** to enter your current user's password for `sudo` (if need) and then enter the new user's password (if not specified by `--password`).
 
 
 ### All Options
 ### All Options
 
 
- - `-c CN` ~~Debian Installer Country~~ Only useful for the *Chinese Special* settings
- - `-fqdn debian` FQDN including hostname and domain. Priority: `-fqdn` option > rDNS > `debian` as default.
- - `-proto http` Transport protocol for archive mirror only but not security repository (`http`, `https`, `ftp`)
- - `-host deb.debian.org` Host for archive mirror only but not security repository
- - `-dir /debian` Directory path relative to root of the mirror
- - `-suite stretch` Suite (`stable`, `testing`, `stretch`, etc.)
- - `-u debian` Username of admin account with sudo privilege
- - `-p secret` Password of the account **(if not specified, it will be asked interactively)**
- - `-tz UTC` [Time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List)
- - `-ntp pool.ntp.org` NTP server
- - `-upgrade full-upgrade` Whether to upgrade packages after debootstrap (`none`, `safe-upgrade`, `full-upgrade`)
- - `-s http://security.debian.org/debian-security` Custom URL for security repository mirror
- - `-fs ext4` Filesystem for partition
- - `-crypto` Full disk encryption (Can't be fully automated at current time. Need VNC connection to go through the steps)
- - `-ip 192.168.1.42` Configure network manually with an IP address **(the following** `-cidr`**,** `-gw` **and** `-dns` **options only work when an IP address is specified)**
- - `-cidr 255.255.255.0` Netmask for manual network configuration
- - `-gw 192.168.1.1` Gateway for manual network configuration
- - `-ns "8.8.8.8 8.8.4.4"` DNS for manual network configuration
- - `-add "ca-certificates curl fail2ban openssl whois"` Include individual additional packages to install
- - `-ssh secret` Enable network console and specify **password for SSH access during install process**. You can login with `installer` user and check system logs.
- - `-ssh-pubkey https://example.com/id_rsa.pub` Enable network console and specify **SSH public key for SSH access during install process**. You can login with `installer` user and check system logs. You can't access with password if a public key is provided here.
- - `-dry-run` Generate `preseed.cfg` and save to current dir but don't actually do anything
- - `-manually` Manually configure user account and disk partition, etc. (Network, repository mirror & time related settings will be auto-configured)
- - `-arch amd64` Specify architecture (useful under CentOS)
- - `-lvm` Use `/` as the boot root path for the `grub.cfg` instead of `/boot`, useful under LVM partition disks
-
-### Chinese Special
-
-If `-c CN` is used, Chinese Special options will be setup for good connectivity and experience against GFW.
-
- - Default archive mirror is `https://chinanet.mirrors.ustc.edu.cn/debian`.
- - Default security mirror is `https://chinanet.mirrors.ustc.edu.cn/debian-security`.
- - Default time zone is `Asia/Shanghai`.
- - Default NTP server is `cn.ntp.org.cn`.
- - Default DNS is `156.154.70.5 156.154.71.5`.
- - All custom settings will override above defaults.
+ - `--template foobar` Selected template (see below)
+ - `--hostname debian` Hostname. Precedence: provided value > reverse DNS record > the default value `debian`
+ - `--protocol http` Transport protocol to use with the repository mirror (not for the security mirror). Possible values: `http`, `https`, `ftp`, etc.
+ - `--mirror deb.debian.org` Hostname of the repository mirror (not for the security mirror)
+ - `--directory /debian` Directory of the repository mirror
+ - `--suite stretch` Selected suite to install (`stable`, `testing`, `stretch`, etc.)
+ - `--username debian` Username of the administrator account with sudo privilege
+ - `--password secret` Password of the account **(if not specified, it will be asked interactively)**
+ - `--timezone UTC` [Time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List)
+ - `--ntp-server pool.ntp.org` NTP server
+ - `--upgrade full-upgrade` Whether to upgrade packages after debootstrap (`none`, `safe-upgrade`, `full-upgrade`)
+ - `--security-mirror http://security.debian.org/debian-security` Specify a URL for the security mirror or set to `true` to use the same mirror as the repository mirror instead of the default one
+ - `--filesystem ext4` Filesystem for partition
+ - `--disk-encryption` Enable full disk encryption. Since it can't be fully automated currently, you'll need physical console (VNC) access to go through the steps
+ - `--ip 12.34.56.78` Configure network manually with an IP address **(the following** `-cidr`**,** `-gw` **and** `-dns` **options only work when an IP address is specified)**
+ - `--netmask 255.255.255.0` Netmask for manual network configuration
+ - `--gateway 12.34.56.1` Gateway for manual network configuration
+ - `--dns "1.1.1.1 1.0.0.1"` DNS for manual network configuration
+ - `--include "ca-certificates curl fail2ban openssl whois"` Include additional packages to install
+ - `--manual` Manually configure user account and disk partition, etc. Network connection, the repository and security mirrors, time zone and NTP server are already auto-configured
+ - `--ssh-password installerSecret` Enable SSH access to the installer with a password. You can login to `installer` user and continue installation manually or just check system logs.
+ - `--ssh-keys https://example.com/.ssh/authorized_keys` Enable SSH access to the installer with a URL of the file contains authorized public keys. (see above) You can't access with password if authorized public keys are provided here.
+ - `--dry-run` Generate `preseed.cfg` and save to current directory but don't actually do anything
+ - `--architecture amd64` Specify an architecture (useful under CentOS)
+ - `--boot-partition` Use `/` as the boot directory for the GRUB boot entry instead of `/boot`, useful under LVM machines with an independent boot partition
+
+### Templates
+
+You can select a template for quickly applying options. All custom settings will override template values.
+
+#### `china`
+
+ - `--protocol https`
+ - `--mirror chinanet.mirrors.ustc.edu.cn`
+ - `--security-mirror true`
+ - `--timezone Asia/Shanghai`
+ - `--ntp-server cn.ntp.org.cn`
+ - `--dns "156.154.70.5 156.154.71.5"`
+
+#### `cloud`
+
+ - `--protocol https`
+ - `--mirror cdn-aws.deb.debian.org`
+ - `--security-mirror true`
+ - `--ntp-server time.google.com`
 
 
 ## Step 3. Entering Debian Installer
 ## Step 3. Entering Debian Installer
 
 

+ 183 - 198
netboot.sh

@@ -1,6 +1,6 @@
 #!/usr/bin/env sh
 #!/usr/bin/env sh
 
 
-# Copyright 2018 Brent, Yang Bohan
+# Copyright 2018-present Brent, Yang Bohan
 
 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # you may not use this file except in compliance with the License.
@@ -20,103 +20,103 @@ set -ex
 
 
 while [ $# -gt 0 ]; do
 while [ $# -gt 0 ]; do
   case $1 in
   case $1 in
-    -c)
-      DEBNETB_COUNTRY=$2
+    --template)
+      DEBI_TEMPLATE=$2
       shift
       shift
       ;;
       ;;
-    -fqdn)
-      DEBNETB_FQDN=$2
+    --hostname)
+      DEBI_HOSTNAME=$2
       shift
       shift
       ;;
       ;;
-    -proto)
-      DEBNETB_PROTO=$2
+    --protocol)
+      DEBI_PROTOCOL=$2
       shift
       shift
       ;;
       ;;
-    -host)
-      DEBNETB_HOST=$2
+    --mirror)
+      DEBI_MIRROR=$2
       shift
       shift
       ;;
       ;;
-    -dir)
-      DEBNETB_DIR=${2%/}
+    --directory)
+      DEBI_DIRECTORY=${2%/}
       shift
       shift
       ;;
       ;;
-    -suite)
-      DEBNETB_SUITE=$2
+    --suite)
+      DEBI_SUITE=$2
       shift
       shift
       ;;
       ;;
-    -u)
-      DEBNETB_ADMIN=$2
+    --username)
+      DEBI_USERNAME=$2
       shift
       shift
       ;;
       ;;
-    -p)
-      DEBNETB_PASSWD=$2
+    --password)
+      DEBI_PASSWORD=$2
       shift
       shift
       ;;
       ;;
-    -tz)
-      DEBNETB_TIME_ZONE=$2
+    --timezone)
+      DEBI_TIMEZONE=$2
       shift
       shift
       ;;
       ;;
-    -ntp)
-      DEBNETB_NTP=$2
+    --ntp-server)
+      DEBI_NTP_SERVER=$2
       shift
       shift
       ;;
       ;;
-    -s)
-      DEBNETB_SECURITY=$2
+    --security-mirror)
+      DEBI_SECURITY_MIRROR=$2
       shift
       shift
       ;;
       ;;
-    -upgrade)
-      DEBNETB_UPGRADE=$2
+    --upgrade)
+      DEBI_UPGRADE=$2
       shift
       shift
       ;;
       ;;
-    -ip)
-      DEBNETB_IP_ADDR=$2
+    --ip)
+      DEBI_IP=$2
       shift
       shift
       ;;
       ;;
-    -cidr)
-      DEBNETB_NETMASK=$2
+    --netmask)
+      DEBI_NETMASK=$2
       shift
       shift
       ;;
       ;;
-    -gw)
-      DEBNETB_GATEWAY=$2
+    --gateway)
+      DEBI_GATEWAY=$2
       shift
       shift
       ;;
       ;;
-    -ns)
-      DEBNETB_DNS=$2
+    --dns)
+      DEBI_DNS=$2
       shift
       shift
       ;;
       ;;
-    -add)
-      DEBNETB_INCLUDE=$2
+    --include)
+      DEBI_INCLUDE=$2
       shift
       shift
       ;;
       ;;
-    -ssh)
-      DEBNETB_SSH=true
-      DEBNETB_SSH_PASSWD=$2
+    --ssh-password)
+      DEBI_SSH=true
+      DEBI_SSH_PASSWD=$2
       shift
       shift
       ;;
       ;;
-    -ssh-pubkey)
-      DEBNETB_SSH=true
-      DEBNETB_SSH_PUBKEY=$2
+    --ssh-keys)
+      DEBI_SSH=true
+      DEBI_SSH_KEYS=$2
       shift
       shift
       ;;
       ;;
-    -fs)
-      DEBNETB_FILESYS=$2
+    --filesystem)
+      DEBI_FILESYSTEM=$2
       shift
       shift
       ;;
       ;;
-    -dry-run)
-      DEBNETB_DRYRUN=true
+    --dry-run)
+      DEBI_DRY_RUN=true
     ;;
     ;;
-    -crypto)
-      DEBNETB_DISKCRYPTO="crypto"
+    --disk-encryption)
+      DEBI_DISK_ENCRYPTION="crypto"
     ;;
     ;;
-    -manually)
-      DEBNETB_MANUALLY=true
+    --manual)
+      DEBI_MANUAL=true
     ;;
     ;;
-    -arch)
-      DEBNETB_ARCH=$2
+    --architecture)
+      DEBI_ARCHITECTURE=$2
       shift
       shift
     ;;
     ;;
-    -lvm)
-      DEBNETB_ISLVM=true
+    --boot-partition)
+      DEBI_BOOT_PARTITION=true
     ;;
     ;;
     *)
     *)
       echo "Illegal option $1"
       echo "Illegal option $1"
@@ -125,112 +125,98 @@ while [ $# -gt 0 ]; do
   shift
   shift
 done
 done
 
 
-case "$DEBNETB_COUNTRY" in
-  CN)
-    DEBNETB_PROTO=${DEBNETB_PROTO:-https}
-    DEBNETB_HOST=${DEBNETB_HOST:-chinanet.mirrors.ustc.edu.cn}
-    DEBNETB_TIME_ZONE=${DEBNETB_TIME_ZONE:-Asia/Shanghai}
-    DEBNETB_NTP=${DEBNETB_NTP:-cn.ntp.org.cn}
-    DEBNETB_SECURITY=${DEBNETB_SECURITY:-true}
-    DEBNETB_DNS=${DEBNETB_DNS:-156.154.70.5 156.154.71.5}
+case "$DEBI_TEMPLATE" in
+  china)
+    DEBI_PROTOCOL=${DEBI_PROTOCOL:-https}
+    DEBI_MIRROR=${DEBI_MIRROR:-chinanet.mirrors.ustc.edu.cn}
+    DEBI_TIMEZONE=${DEBI_TIMEZONE:-Asia/Shanghai}
+    DEBI_NTP_SERVER=${DEBI_NTP_SERVER:-cn.ntp.org.cn}
+    DEBI_SECURITY_MIRROR=${DEBI_SECURITY_MIRROR:-true}
+    DEBI_DNS=${DEBI_DNS:-156.154.70.5 156.154.71.5}
+  vps)
+    DEBI_PROTOCOL=${DEBI_PROTOCOL:-https}
+    DEBI_MIRROR=${DEBI_MIRROR:-cdn-aws.deb.debian.org}
+    DEBI_NTP_SERVER=${DEBI_NTP_SERVER:-time.google.com}
+    DEBI_SECURITY_MIRROR=${DEBI_SECURITY_MIRROR:-true}
 esac
 esac
 
 
-DEBNETB_COUNTRY=${DEBNETB_COUNTRY:-US}
-DEBNETB_PROTO=${DEBNETB_PROTO:-http}
-DEBNETB_HOST=${DEBNETB_HOST:-deb.debian.org}
-DEBNETB_DIR=${DEBNETB_DIR:-/debian}
-if [ -z "$DEBNETB_ARCH" ]; then
-DEBNETB_ARCH=$(dpkg --print-architecture)
+DEBI_PROTOCOL=${DEBI_PROTOCOL:-http}
+DEBI_MIRROR=${DEBI_MIRROR:-deb.debian.org}
+DEBI_DIRECTORY=${DEBI_DIRECTORY:-/debian}
+
+if [ -z "$DEBI_ARCHITECTURE" ]; then
+  DEBI_ARCHITECTURE=$(dpkg --print-architecture)
 fi
 fi
-DEBNETB_SUITE=${DEBNETB_SUITE:-stretch}
-DEBNETB_ADMIN=${DEBNETB_ADMIN:-debian}
-DEBNETB_TIME_ZONE=${DEBNETB_TIME_ZONE:-UTC}
-DEBNETB_NTP=${DEBNETB_NTP:-pool.ntp.org}
-DEBNETB_UPGRADE=${DEBNETB_UPGRADE:-full-upgrade}
-DEBNETB_DNS=${DEBNETB_DNS:-8.8.8.8 8.8.4.4}
-DEBNETB_FILESYS=${DEBNETB_FILESYS:-ext4}
-DEBNETB_DISKCRYPTO=${DEBNETB_DISKCRYPTO:-regular}
-
-if [ -z "$DEBNETB_SECURITY" ]; then
-  DEBNETB_SECURITY=http://security.debian.org/debian-security
+
+DEBI_SUITE=${DEBI_SUITE:-stretch}
+DEBI_USERNAME=${DEBI_USERNAME:-debian}
+DEBI_TIMEZONE=${DEBI_TIMEZONE:-UTC}
+DEBI_NTP_SERVER=${DEBI_NTP_SERVER:-pool.ntp.org}
+DEBI_UPGRADE=${DEBI_UPGRADE:-full-upgrade}
+DEBI_DNS=${DEBI_DNS:-1.1.1.1 1.0.0.1}
+DEBI_FILESYSTEM=${DEBI_FILESYSTEM:-ext4}
+DEBI_DISK_ENCRYPTION=${DEBI_DISK_ENCRYPTION:-regular}
+
+if [ -z "$DEBI_SECURITY_MIRROR" ]; then
+  DEBI_SECURITY_MIRROR=http://security.debian.org/debian-security
 else
 else
-  if [ "$DEBNETB_SECURITY" = true ]; then
-    DEBNETB_SECURITY=$DEBNETB_PROTO://$DEBNETB_HOST${DEBNETB_DIR%/*}/debian-security
+  if [ "$DEBI_SECURITY_MIRROR" = true ]; then
+    DEBI_SECURITY_MIRROR=$DEBI_PROTOCOL://$DEBI_MIRROR${DEBI_DIRECTORY%/*}/debian-security
   fi
   fi
 fi
 fi
 
 
-if [ "$DEBNETB_MANUALLY" != true ]; then
-if [ -z "$DEBNETB_PASSWD" ]; then
-DEBNETB_PASSWD=$(mkpasswd -m sha-512)
-else
-DEBNETB_PASSWD=$(mkpasswd -m sha-512 "$DEBNETB_PASSWD")
-fi
+if [ "$DEBI_MANUAL" != true ]; then
+  if [ -z "$DEBI_PASSWORD" ]; then
+    DEBI_PASSWORD=$(mkpasswd -m sha-512)
+  else
+    DEBI_PASSWORD=$(mkpasswd -m sha-512 "$DEBI_PASSWORD")
+  fi
 fi
 fi
 
 
-if [ "$DEBNETB_DRYRUN" != true ]; then
-DEBNETB_BOOTNAME="debian-$DEBNETB_SUITE"
-if [ "$DEBNETB_ISLVM" = true ]; then
-DEBNETB_BOOTROOT=/
-else
-DEBNETB_BOOTROOT=/boot/
-fi
-DEBNETB_BOOT="/boot/$DEBNETB_BOOTNAME"
-DEBNETB_OUTPUTBOOT="$DEBNETB_BOOTROOT$DEBNETB_BOOTNAME"
-DEBNETB_URL=$DEBNETB_PROTO://$DEBNETB_HOST$DEBNETB_DIR/dists/$DEBNETB_SUITE/main/installer-$DEBNETB_ARCH/current/images/netboot/debian-installer/$DEBNETB_ARCH
-if type update-grub >/dev/null; then
-update-grub
-DEBNETB_GRUBCFG=/boot/grub/grub.cfg
-else
-DEBNETB_GRUBCFG=/boot/grub2/grub.cfg
-grub2-mkconfig > "$DEBNETB_GRUBCFG"
-fi
-rm -fr "$DEBNETB_BOOT"
-mkdir -p "$DEBNETB_BOOT"
-cd "$DEBNETB_BOOT"
+if [ "$DEBI_DRY_RUN" != true ]; then
+  DEBI_TARGET="debian-$DEBI_SUITE"
+  if [ "$DEBI_BOOT_PARTITION" = true ]; then
+    DEBI_BOOT_DIRECTORY=/
+  else
+    DEBI_BOOT_DIRECTORY=/boot/
+  fi
+  DEBI_WORKDIR="/boot/$DEBI_TARGET"
+  DEBI_TARGET_PATH="$DEBI_BOOT_DIRECTORY$DEBI_TARGET"
+  DEBI_BASE_URL=$DEBI_PROTOCOL://$DEBI_MIRROR$DEBI_DIRECTORY/dists/$DEBI_SUITE/main/installer-$DEBI_ARCHITECTURE/current/images/netboot/debian-installer/$DEBI_ARCHITECTURE
+  if type update-grub >/dev/null; then
+    update-grub
+    DEBI_GRUB_CONFIG=/boot/grub/grub.cfg
+  else
+    DEBI_GRUB_CONFIG=/boot/grub2/grub.cfg
+    grub2-mkconfig > "$DEBI_GRUB_CONFIG"
+  fi
+  rm -fr "$DEBI_WORKDIR"
+  mkdir -p "$DEBI_WORKDIR"
+  cd "$DEBI_WORKDIR"
 fi
 fi
 
 
 cat >> preseed.cfg << EOF
 cat >> preseed.cfg << EOF
-# IP_ADDR: 2
-# NETMASK: 2
-# GATEWAY: 2
-# DNS: 2
-# FQDN: 2
-# SSH_PASSWD: 2
-# PROTO: 3
-# HOST: 3
-# DIR: 3
-# SUITE: 3, 8
-# TIME_ZONE: 4
-# NTP: 4
-# ADMIN: 5
-# PASSWD: 5
-# FILESYS: 6
-# DISKCRYPTO: 6
-# SECURITY: 8
-# INCLUDE: 9
-# UPGRADE: 9
-
-# 1. Localization
+# Localization
 
 
 d-i debian-installer/locale string en_US.UTF-8
 d-i debian-installer/locale string en_US.UTF-8
 d-i keyboard-configuration/xkb-keymap select us
 d-i keyboard-configuration/xkb-keymap select us
 
 
-# 2. Network configuration: IP_ADDR, NETMASK, GATEWAY, DNS, FQDN, SSH_PASSWD
+# Network configuration
 
 
 d-i netcfg/choose_interface select auto
 d-i netcfg/choose_interface select auto
 EOF
 EOF
 
 
-if [ -n "$DEBNETB_IP_ADDR" ]; then
+if [ -n "$DEBI_IP" ]; then
   echo "d-i netcfg/disable_autoconfig boolean true" >> preseed.cfg
   echo "d-i netcfg/disable_autoconfig boolean true" >> preseed.cfg
-  echo "d-i netcfg/get_ipaddress string $DEBNETB_IP_ADDR" >> preseed.cfg
-  if [ -n "$DEBNETB_NETMASK" ]; then
-    echo "d-i netcfg/get_netmask string $DEBNETB_NETMASK" >> preseed.cfg
+  echo "d-i netcfg/get_ipaddress string $DEBI_IP" >> preseed.cfg
+  if [ -n "$DEBI_NETMASK" ]; then
+    echo "d-i netcfg/get_netmask string $DEBI_NETMASK" >> preseed.cfg
   fi
   fi
-  if [ -n "$DEBNETB_GATEWAY" ]; then
-    echo "d-i netcfg/get_gateway string $DEBNETB_GATEWAY" >> preseed.cfg
+  if [ -n "$DEBI_GATEWAY" ]; then
+    echo "d-i netcfg/get_gateway string $DEBI_GATEWAY" >> preseed.cfg
   fi
   fi
-  if [ -n "$DEBNETB_DNS" ]; then
-    echo "d-i netcfg/get_nameservers string $DEBNETB_DNS" >> preseed.cfg
+  if [ -n "$DEBI_DNS" ]; then
+    echo "d-i netcfg/get_nameservers string $DEBI_DNS" >> preseed.cfg
   fi
   fi
   echo "d-i netcfg/confirm_static boolean true" >> preseed.cfg
   echo "d-i netcfg/confirm_static boolean true" >> preseed.cfg
 fi
 fi
@@ -240,76 +226,76 @@ d-i netcfg/get_hostname string debian
 d-i netcfg/get_domain string
 d-i netcfg/get_domain string
 EOF
 EOF
 
 
-if [ -n "$DEBNETB_FQDN" ]; then
-  echo "d-i netcfg/hostname string $DEBNETB_FQDN" >> preseed.cfg
+if [ -n "$DEBI_HOSTNAME" ]; then
+  echo "d-i netcfg/hostname string $DEBI_HOSTNAME" >> preseed.cfg
 fi
 fi
 
 
 cat >> preseed.cfg << EOF
 cat >> preseed.cfg << EOF
 d-i hw-detect/load_firmware boolean true
 d-i hw-detect/load_firmware boolean true
 EOF
 EOF
 
 
-if [ "$DEBNETB_SSH" = true ]; then
+if [ "$DEBI_SSH" = true ]; then
   echo "d-i anna/choose_modules string network-console" >> preseed.cfg
   echo "d-i anna/choose_modules string network-console" >> preseed.cfg
   echo "d-i preseed/early_command string anna-install network-console" >> preseed.cfg
   echo "d-i preseed/early_command string anna-install network-console" >> preseed.cfg
-  if [ -n "$DEBNETB_SSH_PASSWD" ]; then
-    echo "d-i network-console/password password $DEBNETB_SSH_PASSWD" >> preseed.cfg
-    echo "d-i network-console/password-again password $DEBNETB_SSH_PASSWD" >> preseed.cfg
+  if [ -n "$DEBI_SSH_PASSWORD" ]; then
+    echo "d-i network-console/password password $DEBI_SSH_PASSWORD" >> preseed.cfg
+    echo "d-i network-console/password-again password $DEBI_SSH_PASSWORD" >> preseed.cfg
   fi
   fi
-  if [ -n "$DEBNETB_SSH_PUBKEY" ]; then
-    echo "d-i network-console/authorized_keys_url string $DEBNETB_SSH_PUBKEY" >> preseed.cfg
+  if [ -n "$DEBI_SSH_KEYS" ]; then
+    echo "d-i network-console/authorized_keys_url string $DEBI_SSH_KEYS" >> preseed.cfg
   fi
   fi
   echo "d-i network-console/start select Continue" >> preseed.cfg
   echo "d-i network-console/start select Continue" >> preseed.cfg
 fi
 fi
 
 
 cat >> preseed.cfg << EOF
 cat >> preseed.cfg << EOF
 
 
-# 3. Mirror settings: PROTO, HOST, DIR, SUITE
+# Mirror settings
 
 
 d-i mirror/country string manual
 d-i mirror/country string manual
-d-i mirror/protocol string {{-PROTO-}}
-d-i mirror/{{-PROTO-}}/hostname string {{-HOST-}}
-d-i mirror/{{-PROTO-}}/directory string {{-DIR-}}
-d-i mirror/{{-PROTO-}}/proxy string
+d-i mirror/protocol string {{-PROTOCOL-}}
+d-i mirror/{{-PROTOCOL-}}/hostname string {{-MIRROR-}}
+d-i mirror/{{-PROTOCOL-}}/directory string {{-DIRECTORY-}}
+d-i mirror/{{-PROTOCOL-}}/proxy string
 d-i mirror/suite string {{-SUITE-}}
 d-i mirror/suite string {{-SUITE-}}
 d-i mirror/udeb/suite string {{-SUITE-}}
 d-i mirror/udeb/suite string {{-SUITE-}}
 
 
-# 4. Clock and time zone setup: TIME_ZONE, NTP
+# Clock and time zone setup
 
 
 d-i clock-setup/utc boolean true
 d-i clock-setup/utc boolean true
-d-i time/zone string {{-TIME_ZONE-}}
+d-i time/zone string {{-TIMEZONE-}}
 d-i clock-setup/ntp boolean true
 d-i clock-setup/ntp boolean true
-d-i clock-setup/ntp-server string {{-NTP-}}
+d-i clock-setup/ntp-server string {{-NTP_SERVER-}}
 EOF
 EOF
 
 
-if [ "$DEBNETB_MANUALLY" != true ]; then
-cat >> preseed.cfg << EOF
+if [ "$DEBI_MANUAL" != true ]; then
+  cat >> preseed.cfg << EOF
 
 
-# 5. Account setup: ADMIN, PASSWD
+# User account setup
 
 
 d-i passwd/root-login boolean false
 d-i passwd/root-login boolean false
 d-i passwd/user-fullname string
 d-i passwd/user-fullname string
-d-i passwd/username string {{-ADMIN-}}
-d-i passwd/user-password-crypted password {{-PASSWD-}}
+d-i passwd/username string {{-USERNAME-}}
+d-i passwd/user-password-crypted password {{-PASSWORD-}}
 
 
-# 6. Partitioning: FILESYS
+# Disk partitioning
 
 
 d-i partman-basicfilesystems/no_swap boolean false
 d-i partman-basicfilesystems/no_swap boolean false
-d-i partman/default_filesystem string {{-FILESYS-}}
-d-i partman-auto/method string {{-DISKCRYPTO-}}
+d-i partman/default_filesystem string {{-FILESYSTEM-}}
+d-i partman-auto/method string {{-DISK_ENCRYPTION-}}
 d-i partman-lvm/device_remove_lvm boolean true
 d-i partman-lvm/device_remove_lvm boolean true
 d-i partman-md/device_remove_md boolean true
 d-i partman-md/device_remove_md boolean true
 d-i partman-lvm/confirm boolean true
 d-i partman-lvm/confirm boolean true
 d-i partman-lvm/confirm_nooverwrite boolean true
 d-i partman-lvm/confirm_nooverwrite boolean true
 EOF
 EOF
 
 
-if [ "$DEBNETB_DISKCRYPTO" = "regular" ]; then
-cat >> preseed.cfg << EOF
+  if [ "$DEBI_DISK_ENCRYPTION" = "regular" ]; then
+    cat >> preseed.cfg << EOF
 d-i partman-auto/expert_recipe string naive :: 0 1 -1 \$default_filesystem \$primary{ } \$bootable{ } method{ format } format{ } use_filesystem{ } \$default_filesystem{ } mountpoint{ / } .
 d-i partman-auto/expert_recipe string naive :: 0 1 -1 \$default_filesystem \$primary{ } \$bootable{ } method{ format } format{ } use_filesystem{ } \$default_filesystem{ } mountpoint{ / } .
 d-i partman-auto/choose_recipe select naive
 d-i partman-auto/choose_recipe select naive
 EOF
 EOF
-fi
+  fi
 
 
-cat >> preseed.cfg << EOF
+  cat >> preseed.cfg << EOF
 d-i partman-partitioning/confirm_write_new_label boolean true
 d-i partman-partitioning/confirm_write_new_label boolean true
 d-i partman/choose_partition select finish
 d-i partman/choose_partition select finish
 d-i partman/confirm boolean true
 d-i partman/confirm boolean true
@@ -317,69 +303,68 @@ d-i partman/confirm_nooverwrite boolean true
 d-i partman/mount_style select uuid
 d-i partman/mount_style select uuid
 EOF
 EOF
 
 
-cat >> preseed.cfg << EOF
+  cat >> preseed.cfg << EOF
 
 
-# 7. Base system installation
+# Base system installation
 
 
 d-i base-installer/install-recommends boolean false
 d-i base-installer/install-recommends boolean false
 
 
-# 8. Apt setup: SECURITY, SUITE
+# Apt setup
 
 
 d-i apt-setup/services-select multiselect updates
 d-i apt-setup/services-select multiselect updates
-d-i apt-setup/local0/repository string {{-SECURITY-}} {{-SUITE-}}/updates main
+d-i apt-setup/local0/repository string {{-SECURITY_MIRROR-}} {{-SUITE-}}/updates main
 d-i apt-setup/local0/source boolean true
 d-i apt-setup/local0/source boolean true
 
 
-# 9. Package selection: INCLUDE, UPGRADE
+# Package selection
 
 
 tasksel tasksel/first multiselect ssh-server
 tasksel tasksel/first multiselect ssh-server
 EOF
 EOF
 
 
-if [ -n "$DEBNETB_INCLUDE" ]; then
-  echo "d-i pkgsel/include string $DEBNETB_INCLUDE" >> preseed.cfg
-fi
+  if [ -n "$DEBI_INCLUDE" ]; then
+    echo "d-i pkgsel/include string $DEBI_INCLUDE" >> preseed.cfg
+  fi
 
 
-cat >> preseed.cfg << EOF
+  cat >> preseed.cfg << EOF
 d-i pkgsel/upgrade select {{-UPGRADE-}}
 d-i pkgsel/upgrade select {{-UPGRADE-}}
 popularity-contest popularity-contest/participate boolean false
 popularity-contest popularity-contest/participate boolean false
 
 
-# 10. Boot loader installation
+# Boot loader installation
 
 
 d-i grub-installer/only_debian boolean true
 d-i grub-installer/only_debian boolean true
 d-i grub-installer/bootdev string default
 d-i grub-installer/bootdev string default
 
 
-# 11. Finishing up the installation
+# Finishing up the installation
 
 
 d-i finish-install/reboot_in_progress note
 d-i finish-install/reboot_in_progress note
 EOF
 EOF
 fi
 fi
 
 
-sed -i 's/{{-PROTO-}}/'"$DEBNETB_PROTO"'/g' preseed.cfg
-sed -i 's/{{-HOST-}}/'"$DEBNETB_HOST"'/g' preseed.cfg
-sed -i 's/{{-DIR-}}/'$(echo "$DEBNETB_DIR" | sed 's/\//\\\//g')'/g' preseed.cfg
-sed -i 's/{{-SUITE-}}/'"$DEBNETB_SUITE"'/g' preseed.cfg
-sed -i 's/{{-ADMIN-}}/'"$DEBNETB_ADMIN"'/g' preseed.cfg
-sed -i 's/{{-PASSWD-}}/'$(echo "$DEBNETB_PASSWD" | sed 's/\//\\\//g')'/g' preseed.cfg
-sed -i 's/{{-TIME_ZONE-}}/'$(echo "$DEBNETB_TIME_ZONE" | sed 's/\//\\\//g')'/g' preseed.cfg
-sed -i 's/{{-NTP-}}/'"$DEBNETB_NTP"'/g' preseed.cfg
-sed -i 's/{{-SECURITY-}}/'$(echo "$DEBNETB_SECURITY" | sed 's/\//\\\//g')'/g' preseed.cfg
-sed -i 's/{{-UPGRADE-}}/'"$DEBNETB_UPGRADE"'/g' preseed.cfg
-sed -i 's/{{-FILESYS-}}/'"$DEBNETB_FILESYS"'/g' preseed.cfg
-sed -i 's/{{-DISKCRYPTO-}}/'"$DEBNETB_DISKCRYPTO"'/g' preseed.cfg
-
-if [ "$DEBNETB_DRYRUN" != true ]; then
-
-wget "$DEBNETB_URL/linux" "$DEBNETB_URL/initrd.gz"
-gunzip initrd.gz
-echo preseed.cfg | cpio -H newc -o -A -F initrd
-gzip initrd
-
-cat >> "$DEBNETB_GRUBCFG" << EOF
+sed -i 's/{{-PROTOCOL-}}/'"$DEBI_PROTOCOL"'/g' preseed.cfg
+sed -i 's/{{-MIRROR-}}/'"$DEBI_MIRROR"'/g' preseed.cfg
+sed -i 's/{{-DIRECTORY-}}/'$(echo "$DEBI_DIRECTORY" | sed 's/\//\\\//g')'/g' preseed.cfg
+sed -i 's/{{-SUITE-}}/'"$DEBI_SUITE"'/g' preseed.cfg
+sed -i 's/{{-USERNAME-}}/'"$DEBI_USERNAME"'/g' preseed.cfg
+sed -i 's/{{-PASSWORD-}}/'$(echo "$DEBI_PASSWORD" | sed 's/\//\\\//g')'/g' preseed.cfg
+sed -i 's/{{-TIMEZONE-}}/'$(echo "$DEBI_TIMEZONE" | sed 's/\//\\\//g')'/g' preseed.cfg
+sed -i 's/{{-NTP_SERVER-}}/'"$DEBI_NTP_SERVER"'/g' preseed.cfg
+sed -i 's/{{-SECURITY_MIRROR-}}/'$(echo "$DEBI_SECURITY_MIRROR" | sed 's/\//\\\//g')'/g' preseed.cfg
+sed -i 's/{{-UPGRADE-}}/'"$DEBI_UPGRADE"'/g' preseed.cfg
+sed -i 's/{{-FILESYSTEM-}}/'"$DEBI_FILESYS"'/g' preseed.cfg
+sed -i 's/{{-DISK_ENCRYPTION-}}/'"$DEBI_DISK_ENCRYPTION"'/g' preseed.cfg
+
+if [ "$DEBI_DRYRUN" != true ]; then
+  wget "$DEBI_BASE_URL/linux" "$DEBI_BASE_URL/initrd.gz"
+  gunzip initrd.gz
+  echo preseed.cfg | cpio -H newc -o -A -F initrd
+  gzip initrd
+
+  cat >> "$DEBI_GRUB_CONFIG" << EOF
 menuentry 'New Install' --id debian-netboot-installer {
 menuentry 'New Install' --id debian-netboot-installer {
 insmod part_msdos
 insmod part_msdos
 insmod ext2
 insmod ext2
 set root='(hd0,msdos1)'
 set root='(hd0,msdos1)'
-linux $DEBNETB_OUTPUTBOOT/linux
-initrd $DEBNETB_OUTPUTBOOT/initrd.gz
+linux $DEBI_TARGET_PATH/linux
+initrd $DEBI_TARGET_PATH/initrd.gz
 }
 }
 EOF
 EOF