mirror of
https://github.com/bohanyang/debi.git
synced 2026-09-27 06:26:15 +00:00
Update (big change)
This commit is contained in:
@@ -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
|
- `--template foobar` Selected template (see below)
|
||||||
- `-fqdn debian` FQDN including hostname and domain. Priority: `-fqdn` option > rDNS > `debian` as default.
|
- `--hostname debian` Hostname. Precedence: provided value > reverse DNS record > the default value `debian`
|
||||||
- `-proto http` Transport protocol for archive mirror only but not security repository (`http`, `https`, `ftp`)
|
- `--protocol http` Transport protocol to use with the repository mirror (not for the security mirror). Possible values: `http`, `https`, `ftp`, etc.
|
||||||
- `-host deb.debian.org` Host for archive mirror only but not security repository
|
- `--mirror deb.debian.org` Hostname of the repository mirror (not for the security mirror)
|
||||||
- `-dir /debian` Directory path relative to root of the mirror
|
- `--directory /debian` Directory of the repository mirror
|
||||||
- `-suite stretch` Suite (`stable`, `testing`, `stretch`, etc.)
|
- `--suite stretch` Selected suite to install (`stable`, `testing`, `stretch`, etc.)
|
||||||
- `-u debian` Username of admin account with sudo privilege
|
- `--username debian` Username of the administrator account with sudo privilege
|
||||||
- `-p secret` Password of the account **(if not specified, it will be asked interactively)**
|
- `--password 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)
|
- `--timezone UTC` [Time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List)
|
||||||
- `-ntp pool.ntp.org` NTP server
|
- `--ntp-server pool.ntp.org` NTP server
|
||||||
- `-upgrade full-upgrade` Whether to upgrade packages after debootstrap (`none`, `safe-upgrade`, `full-upgrade`)
|
- `--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
|
- `--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
|
||||||
- `-fs ext4` Filesystem for partition
|
- `--filesystem ext4` Filesystem for partition
|
||||||
- `-crypto` Full disk encryption (Can't be fully automated at current time. Need VNC connection to go through the steps)
|
- `--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 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)**
|
- `--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)**
|
||||||
- `-cidr 255.255.255.0` Netmask for manual network configuration
|
- `--netmask 255.255.255.0` Netmask for manual network configuration
|
||||||
- `-gw 192.168.1.1` Gateway for manual network configuration
|
- `--gateway 12.34.56.1` Gateway for manual network configuration
|
||||||
- `-ns "8.8.8.8 8.8.4.4"` DNS for manual network configuration
|
- `--dns "1.1.1.1 1.0.0.1"` DNS for manual network configuration
|
||||||
- `-add "ca-certificates curl fail2ban openssl whois"` Include individual additional packages to install
|
- `--include "ca-certificates curl fail2ban openssl whois"` Include 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.
|
- `--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-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.
|
- `--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.
|
||||||
- `-dry-run` Generate `preseed.cfg` and save to current dir but don't actually do anything
|
- `--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.
|
||||||
- `-manually` Manually configure user account and disk partition, etc. (Network, repository mirror & time related settings will be auto-configured)
|
- `--dry-run` Generate `preseed.cfg` and save to current directory but don't actually do anything
|
||||||
- `-arch amd64` Specify architecture (useful under CentOS)
|
- `--architecture amd64` Specify an architecture (useful under CentOS)
|
||||||
- `-lvm` Use `/` as the boot root path for the `grub.cfg` instead of `/boot`, useful under LVM partition disks
|
- `--boot-partition` Use `/` as the boot directory for the GRUB boot entry instead of `/boot`, useful under LVM machines with an independent boot partition
|
||||||
|
|
||||||
### Chinese Special
|
### Templates
|
||||||
|
|
||||||
If `-c CN` is used, Chinese Special options will be setup for good connectivity and experience against GFW.
|
You can select a template for quickly applying options. All custom settings will override template values.
|
||||||
|
|
||||||
- Default archive mirror is `https://chinanet.mirrors.ustc.edu.cn/debian`.
|
#### `china`
|
||||||
- Default security mirror is `https://chinanet.mirrors.ustc.edu.cn/debian-security`.
|
|
||||||
- Default time zone is `Asia/Shanghai`.
|
- `--protocol https`
|
||||||
- Default NTP server is `cn.ntp.org.cn`.
|
- `--mirror chinanet.mirrors.ustc.edu.cn`
|
||||||
- Default DNS is `156.154.70.5 156.154.71.5`.
|
- `--security-mirror true`
|
||||||
- All custom settings will override above defaults.
|
- `--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
|
||||||
|
|
||||||
|
|||||||
+163
-178
@@ -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)
|
--template)
|
||||||
DEBNETB_COUNTRY=$2
|
DEBI_TEMPLATE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-fqdn)
|
--hostname)
|
||||||
DEBNETB_FQDN=$2
|
DEBI_HOSTNAME=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-proto)
|
--protocol)
|
||||||
DEBNETB_PROTO=$2
|
DEBI_PROTOCOL=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-host)
|
--mirror)
|
||||||
DEBNETB_HOST=$2
|
DEBI_MIRROR=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-dir)
|
--directory)
|
||||||
DEBNETB_DIR=${2%/}
|
DEBI_DIRECTORY=${2%/}
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-suite)
|
--suite)
|
||||||
DEBNETB_SUITE=$2
|
DEBI_SUITE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-u)
|
--username)
|
||||||
DEBNETB_ADMIN=$2
|
DEBI_USERNAME=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-p)
|
--password)
|
||||||
DEBNETB_PASSWD=$2
|
DEBI_PASSWORD=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-tz)
|
--timezone)
|
||||||
DEBNETB_TIME_ZONE=$2
|
DEBI_TIMEZONE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-ntp)
|
--ntp-server)
|
||||||
DEBNETB_NTP=$2
|
DEBI_NTP_SERVER=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-s)
|
--security-mirror)
|
||||||
DEBNETB_SECURITY=$2
|
DEBI_SECURITY_MIRROR=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-upgrade)
|
--upgrade)
|
||||||
DEBNETB_UPGRADE=$2
|
DEBI_UPGRADE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-ip)
|
--ip)
|
||||||
DEBNETB_IP_ADDR=$2
|
DEBI_IP=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-cidr)
|
--netmask)
|
||||||
DEBNETB_NETMASK=$2
|
DEBI_NETMASK=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-gw)
|
--gateway)
|
||||||
DEBNETB_GATEWAY=$2
|
DEBI_GATEWAY=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-ns)
|
--dns)
|
||||||
DEBNETB_DNS=$2
|
DEBI_DNS=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-add)
|
--include)
|
||||||
DEBNETB_INCLUDE=$2
|
DEBI_INCLUDE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-ssh)
|
--ssh-password)
|
||||||
DEBNETB_SSH=true
|
DEBI_SSH=true
|
||||||
DEBNETB_SSH_PASSWD=$2
|
DEBI_SSH_PASSWD=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-ssh-pubkey)
|
--ssh-keys)
|
||||||
DEBNETB_SSH=true
|
DEBI_SSH=true
|
||||||
DEBNETB_SSH_PUBKEY=$2
|
DEBI_SSH_KEYS=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-fs)
|
--filesystem)
|
||||||
DEBNETB_FILESYS=$2
|
DEBI_FILESYSTEM=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-dry-run)
|
--dry-run)
|
||||||
DEBNETB_DRYRUN=true
|
DEBI_DRY_RUN=true
|
||||||
;;
|
;;
|
||||||
-crypto)
|
--disk-encryption)
|
||||||
DEBNETB_DISKCRYPTO="crypto"
|
DEBI_DISK_ENCRYPTION="crypto"
|
||||||
;;
|
;;
|
||||||
-manually)
|
--manual)
|
||||||
DEBNETB_MANUALLY=true
|
DEBI_MANUAL=true
|
||||||
;;
|
;;
|
||||||
-arch)
|
--architecture)
|
||||||
DEBNETB_ARCH=$2
|
DEBI_ARCHITECTURE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-lvm)
|
--boot-partition)
|
||||||
DEBNETB_ISLVM=true
|
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
|
case "$DEBI_TEMPLATE" in
|
||||||
CN)
|
china)
|
||||||
DEBNETB_PROTO=${DEBNETB_PROTO:-https}
|
DEBI_PROTOCOL=${DEBI_PROTOCOL:-https}
|
||||||
DEBNETB_HOST=${DEBNETB_HOST:-chinanet.mirrors.ustc.edu.cn}
|
DEBI_MIRROR=${DEBI_MIRROR:-chinanet.mirrors.ustc.edu.cn}
|
||||||
DEBNETB_TIME_ZONE=${DEBNETB_TIME_ZONE:-Asia/Shanghai}
|
DEBI_TIMEZONE=${DEBI_TIMEZONE:-Asia/Shanghai}
|
||||||
DEBNETB_NTP=${DEBNETB_NTP:-cn.ntp.org.cn}
|
DEBI_NTP_SERVER=${DEBI_NTP_SERVER:-cn.ntp.org.cn}
|
||||||
DEBNETB_SECURITY=${DEBNETB_SECURITY:-true}
|
DEBI_SECURITY_MIRROR=${DEBI_SECURITY_MIRROR:-true}
|
||||||
DEBNETB_DNS=${DEBNETB_DNS:-156.154.70.5 156.154.71.5}
|
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}
|
DEBI_PROTOCOL=${DEBI_PROTOCOL:-http}
|
||||||
DEBNETB_PROTO=${DEBNETB_PROTO:-http}
|
DEBI_MIRROR=${DEBI_MIRROR:-deb.debian.org}
|
||||||
DEBNETB_HOST=${DEBNETB_HOST:-deb.debian.org}
|
DEBI_DIRECTORY=${DEBI_DIRECTORY:-/debian}
|
||||||
DEBNETB_DIR=${DEBNETB_DIR:-/debian}
|
|
||||||
if [ -z "$DEBNETB_ARCH" ]; then
|
|
||||||
DEBNETB_ARCH=$(dpkg --print-architecture)
|
|
||||||
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
|
if [ -z "$DEBI_ARCHITECTURE" ]; then
|
||||||
DEBNETB_SECURITY=http://security.debian.org/debian-security
|
DEBI_ARCHITECTURE=$(dpkg --print-architecture)
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
if [ "$DEBI_SECURITY_MIRROR" = true ]; then
|
||||||
DEBNETB_SECURITY=$DEBNETB_PROTO://$DEBNETB_HOST${DEBNETB_DIR%/*}/debian-security
|
DEBI_SECURITY_MIRROR=$DEBI_PROTOCOL://$DEBI_MIRROR${DEBI_DIRECTORY%/*}/debian-security
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DEBNETB_MANUALLY" != true ]; then
|
if [ "$DEBI_MANUAL" != true ]; then
|
||||||
if [ -z "$DEBNETB_PASSWD" ]; then
|
if [ -z "$DEBI_PASSWORD" ]; then
|
||||||
DEBNETB_PASSWD=$(mkpasswd -m sha-512)
|
DEBI_PASSWORD=$(mkpasswd -m sha-512)
|
||||||
else
|
else
|
||||||
DEBNETB_PASSWD=$(mkpasswd -m sha-512 "$DEBNETB_PASSWD")
|
DEBI_PASSWORD=$(mkpasswd -m sha-512 "$DEBI_PASSWORD")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DEBNETB_DRYRUN" != true ]; then
|
if [ "$DEBI_DRY_RUN" != true ]; then
|
||||||
DEBNETB_BOOTNAME="debian-$DEBNETB_SUITE"
|
DEBI_TARGET="debian-$DEBI_SUITE"
|
||||||
if [ "$DEBNETB_ISLVM" = true ]; then
|
if [ "$DEBI_BOOT_PARTITION" = true ]; then
|
||||||
DEBNETB_BOOTROOT=/
|
DEBI_BOOT_DIRECTORY=/
|
||||||
else
|
else
|
||||||
DEBNETB_BOOTROOT=/boot/
|
DEBI_BOOT_DIRECTORY=/boot/
|
||||||
fi
|
fi
|
||||||
DEBNETB_BOOT="/boot/$DEBNETB_BOOTNAME"
|
DEBI_WORKDIR="/boot/$DEBI_TARGET"
|
||||||
DEBNETB_OUTPUTBOOT="$DEBNETB_BOOTROOT$DEBNETB_BOOTNAME"
|
DEBI_TARGET_PATH="$DEBI_BOOT_DIRECTORY$DEBI_TARGET"
|
||||||
DEBNETB_URL=$DEBNETB_PROTO://$DEBNETB_HOST$DEBNETB_DIR/dists/$DEBNETB_SUITE/main/installer-$DEBNETB_ARCH/current/images/netboot/debian-installer/$DEBNETB_ARCH
|
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
|
if type update-grub >/dev/null; then
|
||||||
update-grub
|
update-grub
|
||||||
DEBNETB_GRUBCFG=/boot/grub/grub.cfg
|
DEBI_GRUB_CONFIG=/boot/grub/grub.cfg
|
||||||
else
|
else
|
||||||
DEBNETB_GRUBCFG=/boot/grub2/grub.cfg
|
DEBI_GRUB_CONFIG=/boot/grub2/grub.cfg
|
||||||
grub2-mkconfig > "$DEBNETB_GRUBCFG"
|
grub2-mkconfig > "$DEBI_GRUB_CONFIG"
|
||||||
fi
|
fi
|
||||||
rm -fr "$DEBNETB_BOOT"
|
rm -fr "$DEBI_WORKDIR"
|
||||||
mkdir -p "$DEBNETB_BOOT"
|
mkdir -p "$DEBI_WORKDIR"
|
||||||
cd "$DEBNETB_BOOT"
|
cd "$DEBI_WORKDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat >> preseed.cfg << EOF
|
cat >> preseed.cfg << EOF
|
||||||
# IP_ADDR: 2
|
# Localization
|
||||||
# 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
|
|
||||||
|
|
||||||
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
|
echo "d-i netcfg/get_ipaddress string $DEBI_IP" >> preseed.cfg
|
||||||
if [ -n "$DEBNETB_NETMASK" ]; then
|
if [ -n "$DEBI_NETMASK" ]; then
|
||||||
echo "d-i netcfg/get_netmask string $DEBNETB_NETMASK" >> preseed.cfg
|
echo "d-i netcfg/get_netmask string $DEBI_NETMASK" >> preseed.cfg
|
||||||
fi
|
fi
|
||||||
if [ -n "$DEBNETB_GATEWAY" ]; then
|
if [ -n "$DEBI_GATEWAY" ]; then
|
||||||
echo "d-i netcfg/get_gateway string $DEBNETB_GATEWAY" >> preseed.cfg
|
echo "d-i netcfg/get_gateway string $DEBI_GATEWAY" >> preseed.cfg
|
||||||
fi
|
fi
|
||||||
if [ -n "$DEBNETB_DNS" ]; then
|
if [ -n "$DEBI_DNS" ]; then
|
||||||
echo "d-i netcfg/get_nameservers string $DEBNETB_DNS" >> preseed.cfg
|
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,69 +226,69 @@ 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
|
if [ -n "$DEBI_HOSTNAME" ]; then
|
||||||
echo "d-i netcfg/hostname string $DEBNETB_FQDN" >> preseed.cfg
|
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
|
if [ -n "$DEBI_SSH_PASSWORD" ]; then
|
||||||
echo "d-i network-console/password password $DEBNETB_SSH_PASSWD" >> preseed.cfg
|
echo "d-i network-console/password password $DEBI_SSH_PASSWORD" >> preseed.cfg
|
||||||
echo "d-i network-console/password-again password $DEBNETB_SSH_PASSWD" >> preseed.cfg
|
echo "d-i network-console/password-again password $DEBI_SSH_PASSWORD" >> preseed.cfg
|
||||||
fi
|
fi
|
||||||
if [ -n "$DEBNETB_SSH_PUBKEY" ]; then
|
if [ -n "$DEBI_SSH_KEYS" ]; then
|
||||||
echo "d-i network-console/authorized_keys_url string $DEBNETB_SSH_PUBKEY" >> preseed.cfg
|
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/protocol string {{-PROTOCOL-}}
|
||||||
d-i mirror/{{-PROTO-}}/hostname string {{-HOST-}}
|
d-i mirror/{{-PROTOCOL-}}/hostname string {{-MIRROR-}}
|
||||||
d-i mirror/{{-PROTO-}}/directory string {{-DIR-}}
|
d-i mirror/{{-PROTOCOL-}}/directory string {{-DIRECTORY-}}
|
||||||
d-i mirror/{{-PROTO-}}/proxy string
|
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
|
if [ "$DEBI_MANUAL" != true ]; then
|
||||||
cat >> preseed.cfg << EOF
|
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/username string {{-USERNAME-}}
|
||||||
d-i passwd/user-password-crypted password {{-PASSWD-}}
|
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/default_filesystem string {{-FILESYSTEM-}}
|
||||||
d-i partman-auto/method string {{-DISKCRYPTO-}}
|
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
|
if [ "$DEBI_DISK_ENCRYPTION" = "regular" ]; then
|
||||||
cat >> preseed.cfg << EOF
|
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
|
||||||
@@ -319,67 +305,66 @@ 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
|
if [ -n "$DEBI_INCLUDE" ]; then
|
||||||
echo "d-i pkgsel/include string $DEBNETB_INCLUDE" >> preseed.cfg
|
echo "d-i pkgsel/include string $DEBI_INCLUDE" >> preseed.cfg
|
||||||
fi
|
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/{{-PROTOCOL-}}/'"$DEBI_PROTOCOL"'/g' preseed.cfg
|
||||||
sed -i 's/{{-HOST-}}/'"$DEBNETB_HOST"'/g' preseed.cfg
|
sed -i 's/{{-MIRROR-}}/'"$DEBI_MIRROR"'/g' preseed.cfg
|
||||||
sed -i 's/{{-DIR-}}/'$(echo "$DEBNETB_DIR" | sed 's/\//\\\//g')'/g' preseed.cfg
|
sed -i 's/{{-DIRECTORY-}}/'$(echo "$DEBI_DIRECTORY" | sed 's/\//\\\//g')'/g' preseed.cfg
|
||||||
sed -i 's/{{-SUITE-}}/'"$DEBNETB_SUITE"'/g' preseed.cfg
|
sed -i 's/{{-SUITE-}}/'"$DEBI_SUITE"'/g' preseed.cfg
|
||||||
sed -i 's/{{-ADMIN-}}/'"$DEBNETB_ADMIN"'/g' preseed.cfg
|
sed -i 's/{{-USERNAME-}}/'"$DEBI_USERNAME"'/g' preseed.cfg
|
||||||
sed -i 's/{{-PASSWD-}}/'$(echo "$DEBNETB_PASSWD" | sed 's/\//\\\//g')'/g' preseed.cfg
|
sed -i 's/{{-PASSWORD-}}/'$(echo "$DEBI_PASSWORD" | sed 's/\//\\\//g')'/g' preseed.cfg
|
||||||
sed -i 's/{{-TIME_ZONE-}}/'$(echo "$DEBNETB_TIME_ZONE" | sed 's/\//\\\//g')'/g' preseed.cfg
|
sed -i 's/{{-TIMEZONE-}}/'$(echo "$DEBI_TIMEZONE" | sed 's/\//\\\//g')'/g' preseed.cfg
|
||||||
sed -i 's/{{-NTP-}}/'"$DEBNETB_NTP"'/g' preseed.cfg
|
sed -i 's/{{-NTP_SERVER-}}/'"$DEBI_NTP_SERVER"'/g' preseed.cfg
|
||||||
sed -i 's/{{-SECURITY-}}/'$(echo "$DEBNETB_SECURITY" | sed 's/\//\\\//g')'/g' preseed.cfg
|
sed -i 's/{{-SECURITY_MIRROR-}}/'$(echo "$DEBI_SECURITY_MIRROR" | sed 's/\//\\\//g')'/g' preseed.cfg
|
||||||
sed -i 's/{{-UPGRADE-}}/'"$DEBNETB_UPGRADE"'/g' preseed.cfg
|
sed -i 's/{{-UPGRADE-}}/'"$DEBI_UPGRADE"'/g' preseed.cfg
|
||||||
sed -i 's/{{-FILESYS-}}/'"$DEBNETB_FILESYS"'/g' preseed.cfg
|
sed -i 's/{{-FILESYSTEM-}}/'"$DEBI_FILESYS"'/g' preseed.cfg
|
||||||
sed -i 's/{{-DISKCRYPTO-}}/'"$DEBNETB_DISKCRYPTO"'/g' preseed.cfg
|
sed -i 's/{{-DISK_ENCRYPTION-}}/'"$DEBI_DISK_ENCRYPTION"'/g' preseed.cfg
|
||||||
|
|
||||||
if [ "$DEBNETB_DRYRUN" != true ]; then
|
if [ "$DEBI_DRYRUN" != true ]; then
|
||||||
|
wget "$DEBI_BASE_URL/linux" "$DEBI_BASE_URL/initrd.gz"
|
||||||
wget "$DEBNETB_URL/linux" "$DEBNETB_URL/initrd.gz"
|
|
||||||
gunzip initrd.gz
|
gunzip initrd.gz
|
||||||
echo preseed.cfg | cpio -H newc -o -A -F initrd
|
echo preseed.cfg | cpio -H newc -o -A -F initrd
|
||||||
gzip initrd
|
gzip initrd
|
||||||
|
|
||||||
cat >> "$DEBNETB_GRUBCFG" << EOF
|
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
|
linux $DEBI_TARGET_PATH/linux
|
||||||
initrd $DEBNETB_OUTPUTBOOT/initrd.gz
|
initrd $DEBI_TARGET_PATH/initrd.gz
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user