mirror of
https://github.com/bohanyang/debi.git
synced 2026-09-26 22:16:11 +00:00
Update
This commit is contained in:
@@ -32,11 +32,11 @@ This script is written to reinstall a VPS/virtual machine to Debian 10 Buster.
|
|||||||
|
|
||||||
## Available Options
|
## Available Options
|
||||||
|
|
||||||
* `--ip <string>` Static public/private IP, e.g. `10.0.0.2`
|
* `--ip <string>` Disable the auto network config (DHCP) and set a static public/private IP address, e.g. `10.0.0.2`
|
||||||
* `--netmask <string>` e.g. `255.255.255.0` / `ffff:ffff:ffff:ffff::`. Ignored if `--ip` is not specified
|
* `--netmask <string>` Subnet mask of the static public/private IP address, e.g. (IPv4) `255.255.255.0` (IPv6) `ffff:ffff:ffff:ffff::`
|
||||||
* `--gateway <string>` e.g. `10.0.0.1`. Ignored if `--ip` is not specified
|
* `--gateway <string>` e.g. `10.0.0.1`
|
||||||
* `--dns '8.8.8.8 8.8.4.4'` Quoted string where IP addresses are seperated by spaces. Ignored if `--ip` is not specified
|
* `--dns '8.8.8.8 8.8.4.4'`
|
||||||
* `--hostname debian`
|
* `--hostname <string>` FQDN hostname (includes the domain name), e.g. `server1.example.com`
|
||||||
* `--network-console` Enable the network console of the installer. `ssh installer@ip` to connect
|
* `--network-console` Enable the network console of the installer. `ssh installer@ip` to connect
|
||||||
* `--suite buster`
|
* `--suite buster`
|
||||||
* `--mirror-protocol http` or `https` or `ftp`
|
* `--mirror-protocol http` or `https` or `ftp`
|
||||||
@@ -60,7 +60,7 @@ This script is written to reinstall a VPS/virtual machine to Debian 10 Buster.
|
|||||||
* `--kernel <string>` Choose an package for the kernel image
|
* `--kernel <string>` Choose an package for the kernel image
|
||||||
* `--cloud-kernel` Choose `linux-image-cloud-amd64` as the kernel image
|
* `--cloud-kernel` Choose `linux-image-cloud-amd64` as the kernel image
|
||||||
* `--no-install-recommends`
|
* `--no-install-recommends`
|
||||||
* `--install 'ca-certificates libpam-systemd'` Additional packages to install. Quoted string where package names are seperated by spaces. Package names specified here will override the default list, rather than append to it
|
* `--install 'ca-certificates libpam-systemd'`
|
||||||
* `--safe-upgrade` **(Default)** `apt upgrade --with-new-pkgs`. [See](https://salsa.debian.org/installer-team/pkgsel/-/blob/master/debian/postinst)
|
* `--safe-upgrade` **(Default)** `apt upgrade --with-new-pkgs`. [See](https://salsa.debian.org/installer-team/pkgsel/-/blob/master/debian/postinst)
|
||||||
* `--full-upgrade` `apt dist-upgrade`
|
* `--full-upgrade` `apt dist-upgrade`
|
||||||
* `--no-upgrade`
|
* `--no-upgrade`
|
||||||
|
|||||||
@@ -250,6 +250,10 @@ done
|
|||||||
installer="debian-$suite"
|
installer="debian-$suite"
|
||||||
installer_directory="/boot/$installer"
|
installer_directory="/boot/$installer"
|
||||||
|
|
||||||
|
while [ -z "$password" ]; do
|
||||||
|
prompt_password
|
||||||
|
done
|
||||||
|
|
||||||
save_preseed='cat'
|
save_preseed='cat'
|
||||||
if [ "$dry_run" != true ]; then
|
if [ "$dry_run" != true ]; then
|
||||||
[ "$(id -u)" -ne 0 ] && err 'root privilege is required'
|
[ "$(id -u)" -ne 0 ] && err 'root privilege is required'
|
||||||
@@ -276,25 +280,32 @@ if [ -n "$ip" ]; then
|
|||||||
echo 'd-i netcfg/disable_autoconfig boolean true' | $save_preseed
|
echo 'd-i netcfg/disable_autoconfig boolean true' | $save_preseed
|
||||||
echo "d-i netcfg/get_ipaddress string $ip" | $save_preseed
|
echo "d-i netcfg/get_ipaddress string $ip" | $save_preseed
|
||||||
[ -n "$netmask" ] && echo "d-i netcfg/get_netmask string $netmask" | $save_preseed
|
[ -n "$netmask" ] && echo "d-i netcfg/get_netmask string $netmask" | $save_preseed
|
||||||
[ -n "$gateway" ] && echo "d-i netcfg/get_gateway string $gateway" | $save_preseed
|
|
||||||
[ -n "$dns" ] && echo "d-i netcfg/get_nameservers string $dns" | $save_preseed
|
|
||||||
echo 'd-i netcfg/confirm_static boolean true' | $save_preseed
|
echo 'd-i netcfg/confirm_static boolean true' | $save_preseed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$save_preseed << 'EOF'
|
[ -n "$gateway" ] && echo "d-i netcfg/get_gateway string $gateway" | $save_preseed
|
||||||
d-i netcfg/get_hostname string debian
|
[ -n "$dns" ] && echo "d-i netcfg/get_nameservers string $dns" | $save_preseed
|
||||||
d-i netcfg/get_domain string
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ -n "$hostname" ]; then
|
if [ -n "$hostname" ]; then
|
||||||
echo "d-i netcfg/hostname string $hostname" | $save_preseed
|
echo "d-i netcfg/hostname string $hostname" | $save_preseed
|
||||||
|
hostname=debian
|
||||||
|
domain=
|
||||||
|
else
|
||||||
|
hostname=$(cat /proc/sys/kernel/hostname)
|
||||||
|
domain=$(cat /proc/sys/kernel/domainname)
|
||||||
|
if [ "$domain" = '(none)' ]; then
|
||||||
|
domain=
|
||||||
|
else
|
||||||
|
domain=" $domain"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'd-i hw-detect/load_firmware boolean true' | $save_preseed
|
$save_preseed << EOF
|
||||||
|
d-i netcfg/get_hostname string $hostname
|
||||||
|
d-i netcfg/get_domain string$domain
|
||||||
|
EOF
|
||||||
|
|
||||||
while [ -z "$password" ]; do
|
echo 'd-i hw-detect/load_firmware boolean true' | $save_preseed
|
||||||
prompt_password
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$network_console" = true ]; then
|
if [ "$network_console" = true ]; then
|
||||||
$save_preseed << EOF
|
$save_preseed << EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user