mirror of
https://github.com/bohanyang/debi.git
synced 2026-09-27 06:26:15 +00:00
Update without testing!
This commit is contained in:
@@ -21,24 +21,23 @@ sudo sh -c "$(wget -O - https://github.com/brentybh/debian-netboot/raw/master/ne
|
|||||||
|
|
||||||
### All Options
|
### All Options
|
||||||
|
|
||||||
- `-c <COUNTRY>` Debian Installer Country. Default is `US`.
|
- `-c US` Debian Installer Country
|
||||||
- `-h <HOST>` Hostname. Default is `debian`.
|
- `-fqdn localhost` FQDN including hostname and domain
|
||||||
- `-x <TRANSPORT>` Transport protocol for archive mirror only (not security repo). Default is `http`. `https` and `ftp` is also available.
|
- `-proto https` Transport protocol for archive mirror only but not security repository (`http`, `https`, `ftp`)
|
||||||
- `-m <MIRROR>` Host name for archive mirror only (not security repo). Default is `deb.debian.org`.
|
- `-host dpvctowv9b08b.cloudfront.net` Host for archive mirror only but not security repository
|
||||||
- `-d <DIRECTORY>` Directory path relative to root of the mirror. Default is `/debian`.
|
- `-dir /debian` Directory path relative to root of the mirror
|
||||||
- `-r <SUITE>` Suite to install. Suite name (`stable`, `testing`, etc.) or releases code name (`stretch`, etc.) Default is `stretch`.
|
- `-suite stretch` Suite (`stable`, `testing`, `stretch`, etc.)
|
||||||
- `-u <USERNAME>` Username of admin account with sudo privilege. Default is `debian`.
|
- `-u ubuntu` Username of admin account with sudo privilege
|
||||||
- `-p <PASSWORD>` Password of the account. If not specified, it will be asked interactively.
|
- `-p secret` Password of the account (if not specified, it will be asked interactively)
|
||||||
- `-z <TIMEZONE>` [Time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). Default is `UTC`.
|
- `-tz UTC` [Time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List)
|
||||||
- `-t <NTPSERVER>` NTP server. Default is `pool.ntp.org`.
|
- `-ntp time.google.com` NTP server
|
||||||
- `-g <UPGRADE>` Whether to upgrade packages after debootstrap. Default is `full-upgrade`. `none` and `safe-upgrade` is also available.
|
- `-upgrade full-upgrade` Whether to upgrade packages after debootstrap (`none`, `safe-upgrade`, `full-upgrade`)
|
||||||
- `-s <SECURITY>` Custom URL for security repository mirror. Default is `http://security.debian.org/debian-security`.
|
- `-s https://dpvctowv9b08b.cloudfront.net/debian-security` Custom URL for security repository mirror
|
||||||
- `-l` Security mirror linking. If the option present, security repository will be setup as same as the archive mirror instead of `security.debian.org`.
|
- `-ip 1.2.3.4` Configure network manually with an IP address (following options only work when IP address specified)
|
||||||
- `--addr <IPADDR>` Configure network manually with an IP address. Following options only work when IP address specified.
|
- `-cidr 255.255.255.0` Netmask for manual network configuration
|
||||||
- `--mask <NETMASK>` Netmask for manual network configuration
|
- `-gw 1.2.3.1` Gateway for manual network configuration
|
||||||
- `--gate <GATEWAY>` Gateway for manual network configuration
|
- `-ns "1.1.1.1 156.154.70.5 8.8.8.8"` DNS for manual network configuration
|
||||||
- `--dns <DNS>` Domain Name Server for manual network configuration
|
- `-add "ca-certificates curl openssl"` Include individual additional packages to install
|
||||||
- `--incl <INCLUDE>` Include individual additional packages to install
|
|
||||||
|
|
||||||
### Chinese Special
|
### Chinese Special
|
||||||
|
|
||||||
@@ -49,6 +48,5 @@ If `-c CN` is used, Chinese Special options will be setup for good connectivity
|
|||||||
- Default time zone is `Asia/Shanghai`.
|
- Default time zone is `Asia/Shanghai`.
|
||||||
- Default NTP server is `ntp1.aliyun.com`.
|
- Default NTP server is `ntp1.aliyun.com`.
|
||||||
- All custom settings will override above defaults.
|
- All custom settings will override above defaults.
|
||||||
- Security mirror linking (`-l`) will be turned on and can't be turned off. Specify separate security mirror by `-s` option.
|
|
||||||
|
|
||||||
Finally, reboot and enter Debian Installer. It will setup all things automatically.
|
Finally, reboot and enter Debian Installer. It will setup all things automatically.
|
||||||
|
|||||||
+70
-73
@@ -20,74 +20,71 @@ set -ex
|
|||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-c|--country)
|
-c)
|
||||||
COUNTRY=$2
|
COUNTRY=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-h|--hostname)
|
-fqdn)
|
||||||
|
FQDN=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-proto)
|
||||||
|
PROTO=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-host)
|
||||||
HOST=$2
|
HOST=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-x|--transport|--protocol)
|
-dir)
|
||||||
TRANSPORT=$2
|
DIR=${2%/}
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-m|--mirror|--host)
|
-suite)
|
||||||
MIRROR=$2
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-d|--dir|--path|--directory)
|
|
||||||
DIRECTORY=${2%/}
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-r|--suite|--release)
|
|
||||||
SUITE=$2
|
SUITE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-u|--user|--username)
|
-u)
|
||||||
USERNAME=$2
|
USERNAME=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-p|--pass|--password)
|
-p)
|
||||||
PASSWORD=$2
|
PASSWD=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-z|--time|--zone|--timezone)
|
-tz)
|
||||||
TIMEZONE=$2
|
TIMEZONE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-t|--ntp|--ntpserver)
|
-ntp)
|
||||||
NTPSERVER=$2
|
NTP=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-s|--security)
|
-s)
|
||||||
SECURITY=$2
|
SECURITY=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-l|--link|--linked|--linking)
|
--upgrade)
|
||||||
LINKED=true
|
|
||||||
;;
|
|
||||||
-g|--upgrade)
|
|
||||||
UPGRADE=$2
|
UPGRADE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--addr|--ipaddr)
|
-ip)
|
||||||
IPADDR=$2
|
IP_ADDR=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--mask|--netmask)
|
-cidr)
|
||||||
NETMASK=$2
|
NETMASK=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--gate|--gateway)
|
-gw)
|
||||||
GATEWAY=$2
|
GATEWAY=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--dns|--dnserver|--dnsserver)
|
-ns)
|
||||||
DNS=$2
|
DNS=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--incl|--include)
|
-add)
|
||||||
INCLUDE=$2
|
INCLUDE=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
@@ -100,42 +97,42 @@ done
|
|||||||
|
|
||||||
case "$COUNTRY" in
|
case "$COUNTRY" in
|
||||||
CN)
|
CN)
|
||||||
TRANSPORT=${TRANSPORT:-https}
|
PROTO=${PROTO:-https}
|
||||||
MIRROR=${MIRROR:-chinanet.mirrors.ustc.edu.cn}
|
HOST=${HOST:-chinanet.mirrors.ustc.edu.cn}
|
||||||
TIMEZONE=${TIMEZONE:-Asia/Shanghai}
|
TIMEZONE=${TIMEZONE:-Asia/Shanghai}
|
||||||
NTPSERVER=${NTPSERVER:-ntp1.aliyun.com}
|
NTP=${NTP:-ntp1.aliyun.com}
|
||||||
LINKED=${LINKED:-true}
|
SECURITY=${SECURITY:-true}
|
||||||
esac
|
esac
|
||||||
|
|
||||||
COUNTRY=${COUNTRY:-US}
|
COUNTRY=${COUNTRY:-US}
|
||||||
HOST=${HOST:-debian}
|
FQDN=${FQDN:-localhost}
|
||||||
TRANSPORT=${TRANSPORT:-http}
|
PROTO=${PROTO:-https}
|
||||||
MIRROR=${MIRROR:-deb.debian.org}
|
HOST=${HOST:-dpvctowv9b08b.cloudfront.net}
|
||||||
DIRECTORY=${DIRECTORY:-/debian}
|
DIR=${DIR:-/debian}
|
||||||
ARCH=$(dpkg --print-architecture)
|
ARCH=$(dpkg --print-architecture)
|
||||||
SUITE=${SUITE:-stretch}
|
SUITE=${SUITE:-stretch}
|
||||||
USERNAME=${USERNAME:-debian}
|
USERNAME=${USERNAME:-ubuntu}
|
||||||
TIMEZONE=${TIMEZONE:-UTC}
|
TIMEZONE=${TIMEZONE:-UTC}
|
||||||
NTPSERVER=${NTPSERVER:-pool.ntp.org}
|
NTP=${NTP:-time.google.com}
|
||||||
UPGRADE=${UPGRADE:-full-upgrade}
|
UPGRADE=${UPGRADE:-full-upgrade}
|
||||||
LINKED=${LINKED:-false}
|
DNS=${DNS:-1.1.1.1 156.154.70.5 8.8.8.8}
|
||||||
|
|
||||||
if [ -z "$SECURITY" ]; then
|
if [ -z "$SECURITY" ]; then
|
||||||
if $LINKED; then
|
SECURITY=https://dpvctowv9b08b.cloudfront.net/debian-security
|
||||||
SECURITY=$TRANSPORT://$MIRROR${DIRECTORY%/*}/debian-security
|
else
|
||||||
else
|
if [ "$SECURITY" = true ]; then
|
||||||
SECURITY=http://security.debian.org/debian-security
|
SECURITY=$PROTO://$HOST${DIR%/*}/debian-security
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$PASSWORD" ]; then
|
if [ -z "$PASSWD" ]; then
|
||||||
PASSWORD=$(mkpasswd -m sha-512)
|
PASSWD=$(mkpasswd -m sha-512)
|
||||||
else
|
else
|
||||||
PASSWORD=$(mkpasswd -m sha-512 "$PASSWORD")
|
PASSWD=$(mkpasswd -m sha-512 "$PASSWD")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BOOT=/boot/debian-$SUITE
|
BOOT=/boot/debian-$SUITE
|
||||||
URL=$TRANSPORT://$MIRROR$DIRECTORY/dists/$SUITE/main/installer-$ARCH/current/images/netboot/debian-installer/$ARCH
|
URL=$PROTO://$HOST$DIR/dists/$SUITE/main/installer-$ARCH/current/images/netboot/debian-installer/$ARCH
|
||||||
|
|
||||||
update-grub
|
update-grub
|
||||||
rm -fr "$BOOT"
|
rm -fr "$BOOT"
|
||||||
@@ -144,15 +141,15 @@ cd "$BOOT"
|
|||||||
|
|
||||||
cat >> preseed.cfg << EOF
|
cat >> preseed.cfg << EOF
|
||||||
# COUNTRY: 1
|
# COUNTRY: 1
|
||||||
# HOST: 2
|
# FQDN: 2
|
||||||
# TRANSPORT: 3
|
# PROTO: 3
|
||||||
# MIRROR: 3
|
# HOST: 3
|
||||||
# DIRECTORY: 3
|
# DIR: 3
|
||||||
# SUITE: 3, 8
|
# SUITE: 3, 8
|
||||||
# USERNAME: 4
|
# USERNAME: 4
|
||||||
# PASSWORD: 4
|
# PASSWD: 4
|
||||||
# TIMEZONE: 5
|
# TIMEZONE: 5
|
||||||
# NTPSERVER: 5
|
# NTP: 5
|
||||||
# SECURITY: 8
|
# SECURITY: 8
|
||||||
# UPGRADE: 9
|
# UPGRADE: 9
|
||||||
|
|
||||||
@@ -164,14 +161,14 @@ d-i debian-installer/country string {{-COUNTRY-}}
|
|||||||
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: HOST
|
# 2. Network configuration: FQDN
|
||||||
|
|
||||||
d-i netcfg/choose_interface select auto
|
d-i netcfg/choose_interface select auto
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if [ -n "$IPADDR" ]; then
|
if [ -n "$IP_ADDR" ]; 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 $IPADDR" >> preseed.cfg
|
echo "d-i netcfg/get_ipaddress string $IP_ADDR" >> preseed.cfg
|
||||||
if [ -n "$NETMASK" ]; then
|
if [ -n "$NETMASK" ]; then
|
||||||
echo "d-i netcfg/get_netmask string $NETMASK" >> preseed.cfg
|
echo "d-i netcfg/get_netmask string $NETMASK" >> preseed.cfg
|
||||||
fi
|
fi
|
||||||
@@ -187,32 +184,32 @@ fi
|
|||||||
cat >> preseed.cfg << EOF
|
cat >> preseed.cfg << EOF
|
||||||
d-i netcfg/get_hostname string unassigned-hostname
|
d-i netcfg/get_hostname string unassigned-hostname
|
||||||
d-i netcfg/get_domain string unassigned-domain
|
d-i netcfg/get_domain string unassigned-domain
|
||||||
d-i netcfg/hostname string {{-HOST-}}
|
d-i netcfg/hostname string {{-FQDN-}}
|
||||||
d-i hw-detect/load_firmware boolean true
|
d-i hw-detect/load_firmware boolean true
|
||||||
|
|
||||||
# 3. Mirror settings: TRANSPORT, MIRROR, DIRECTORY, SUITE
|
# 3. Mirror settings: PROTO, HOST, DIR, SUITE
|
||||||
|
|
||||||
d-i mirror/country string manual
|
d-i mirror/country string manual
|
||||||
d-i mirror/protocol string {{-TRANSPORT-}}
|
d-i mirror/protocol string {{-PROTO-}}
|
||||||
d-i mirror/{{-TRANSPORT-}}/hostname string {{-MIRROR-}}
|
d-i mirror/{{-PROTO-}}/hostname string {{-HOST-}}
|
||||||
d-i mirror/{{-TRANSPORT-}}/directory string {{-DIRECTORY-}}
|
d-i mirror/{{-PROTO-}}/directory string {{-DIR-}}
|
||||||
d-i mirror/{{-TRANSPORT-}}/proxy string
|
d-i mirror/{{-PROTO-}}/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. Account setup: USERNAME, PASSWORD
|
# 4. Account setup: USERNAME, PASSWD
|
||||||
|
|
||||||
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 {{-USERNAME-}}
|
d-i passwd/username string {{-USERNAME-}}
|
||||||
d-i passwd/user-password-crypted password {{-PASSWORD-}}
|
d-i passwd/user-password-crypted password {{-PASSWD-}}
|
||||||
|
|
||||||
# 5. Clock and time zone setup: TIMEZONE, NTPSERVER
|
# 5. Clock and time zone setup: TIMEZONE, NTP
|
||||||
|
|
||||||
d-i clock-setup/utc boolean true
|
d-i clock-setup/utc boolean true
|
||||||
d-i time/zone string {{-TIMEZONE-}}
|
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 {{-NTPSERVER-}}
|
d-i clock-setup/ntp-server string {{-NTP-}}
|
||||||
|
|
||||||
# 6. Partitioning
|
# 6. Partitioning
|
||||||
|
|
||||||
@@ -260,15 +257,15 @@ d-i grub-installer/bootdev string default
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
sed -i 's/{{-COUNTRY-}}/'"$COUNTRY"'/g' preseed.cfg
|
sed -i 's/{{-COUNTRY-}}/'"$COUNTRY"'/g' preseed.cfg
|
||||||
|
sed -i 's/{{-FQDN-}}/'"$FQDN"'/g' preseed.cfg
|
||||||
|
sed -i 's/{{-PROTO-}}/'"$PROTO"'/g' preseed.cfg
|
||||||
sed -i 's/{{-HOST-}}/'"$HOST"'/g' preseed.cfg
|
sed -i 's/{{-HOST-}}/'"$HOST"'/g' preseed.cfg
|
||||||
sed -i 's/{{-TRANSPORT-}}/'"$TRANSPORT"'/g' preseed.cfg
|
sed -i 's/{{-DIR-}}/'$(echo "$DIR" | sed 's/\//\\\//g')'/g' preseed.cfg
|
||||||
sed -i 's/{{-MIRROR-}}/'"$MIRROR"'/g' preseed.cfg
|
|
||||||
sed -i 's/{{-DIRECTORY-}}/'$(echo "$DIRECTORY" | sed 's/\//\\\//g')'/g' preseed.cfg
|
|
||||||
sed -i 's/{{-SUITE-}}/'"$SUITE"'/g' preseed.cfg
|
sed -i 's/{{-SUITE-}}/'"$SUITE"'/g' preseed.cfg
|
||||||
sed -i 's/{{-USERNAME-}}/'"$USERNAME"'/g' preseed.cfg
|
sed -i 's/{{-USERNAME-}}/'"$USERNAME"'/g' preseed.cfg
|
||||||
sed -i 's/{{-PASSWORD-}}/'$(echo "$PASSWORD" | sed 's/\//\\\//g')'/g' preseed.cfg
|
sed -i 's/{{-PASSWD-}}/'$(echo "$PASSWD" | sed 's/\//\\\//g')'/g' preseed.cfg
|
||||||
sed -i 's/{{-TIMEZONE-}}/'$(echo "$TIMEZONE" | sed 's/\//\\\//g')'/g' preseed.cfg
|
sed -i 's/{{-TIMEZONE-}}/'$(echo "$TIMEZONE" | sed 's/\//\\\//g')'/g' preseed.cfg
|
||||||
sed -i 's/{{-NTPSERVER-}}/'"$NTPSERVER"'/g' preseed.cfg
|
sed -i 's/{{-NTP-}}/'"$NTP"'/g' preseed.cfg
|
||||||
sed -i 's/{{-SECURITY-}}/'$(echo "$SECURITY" | sed 's/\//\\\//g')'/g' preseed.cfg
|
sed -i 's/{{-SECURITY-}}/'$(echo "$SECURITY" | sed 's/\//\\\//g')'/g' preseed.cfg
|
||||||
sed -i 's/{{-UPGRADE-}}/'"$UPGRADE"'/g' preseed.cfg
|
sed -i 's/{{-UPGRADE-}}/'"$UPGRADE"'/g' preseed.cfg
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user