pull/8/head
Bohan Yang 5 years ago
parent 0927602a20
commit 02ed0dc3ef
  1. 2
      README.md
  2. 11
      netboot.sh

@ -30,7 +30,7 @@ This script is used to re-install VPS to **Debian 9 (stretch) or 10 (buster)** w
- `--mirror-protocol http` [`http`, `https`, `ftp`] - `--mirror-protocol http` [`http`, `https`, `ftp`]
- `--mirror-host deb.debian.org` - `--mirror-host deb.debian.org`
- `--mirror-directory /debian` - `--mirror-directory /debian`
- `--suite stable` - `--suite buster`
- `--skip-account-setup` - `--skip-account-setup`
- `--username debian` - `--username debian`
- `--password` - `--password`

@ -198,7 +198,7 @@ if [ -n "$preset" ]; then
esac esac
fi fi
suite=${suite:-stable} suite=${suite:-buster}
installer="debian-$suite" installer="debian-$suite"
installer_directory="/boot/$installer" installer_directory="/boot/$installer"
@ -302,27 +302,34 @@ if [ "$skip_account_setup" != true ]; then
if command_exists mkpasswd; then if command_exists mkpasswd; then
if [ -z "$password" ]; then if [ -z "$password" ]; then
printf 'Password: ' 1>&2
password="$(mkpasswd -m sha512crypt)" password="$(mkpasswd -m sha512crypt)"
echo 1>&2
else else
password="$(mkpasswd -m sha512crypt "$password")" password="$(mkpasswd -m sha512crypt "$password")"
fi fi
elif command_exists busybox && busybox mkpasswd --help >/dev/null 2>&1; then elif command_exists busybox && busybox mkpasswd --help >/dev/null 2>&1; then
if [ -z "$password" ]; then if [ -z "$password" ]; then
printf 'Password: ' 1>&2
password="$(busybox mkpasswd -m sha512)" password="$(busybox mkpasswd -m sha512)"
echo 1>&2
else else
password="$(busybox mkpasswd -m sha512 "$password")" password="$(busybox mkpasswd -m sha512 "$password")"
fi fi
elif command_exists python3; then elif command_exists python3; then
if [ -z "$password" ]; then if [ -z "$password" ]; then
printf 'Password: ' 1>&2
password="$(python3 -c 'import crypt, getpass; print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512)))')" password="$(python3 -c 'import crypt, getpass; print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512)))')"
echo 1>&2
else else
password="$(python3 -c "import crypt; print(crypt.crypt(\"$password\", crypt.mksalt(crypt.METHOD_SHA512)))")" password="$(python3 -c "import crypt; print(crypt.crypt(\"$password\", crypt.mksalt(crypt.METHOD_SHA512)))")"
fi fi
else else
cleartext_password=true cleartext_password=true
if [ -z "$password" ]; then if [ -z "$password" ]; then
printf 'Password: ' printf 'Password: ' 1>&2
read -rs password read -rs password
echo 1>&2
fi fi
fi fi

Loading…
Cancel
Save