setup initial hostname

This commit is contained in:
Gavin Li 2015-06-16 21:57:11 -07:00
parent e2b32f85dc
commit e9f3143bd3
1 changed files with 9 additions and 14 deletions

View File

@ -375,6 +375,7 @@ stage1_install() {
${arch_packages[@]} ${arch_packages[@]}
log "Configuring base system ..." log "Configuring base system ..."
hostname > /d2a/work/archroot/etc/hostname
cp /etc/ssh/ssh_host_* /d2a/work/archroot/etc/ssh/ cp /etc/ssh/ssh_host_* /d2a/work/archroot/etc/ssh/
local encrypted_password=$(awk -F: '$1 == "root" { print $2 }' /etc/shadow) local encrypted_password=$(awk -F: '$1 == "root" { print $2 }' /etc/shadow)
chroot /d2a/work/archroot usermod -p "${encrypted_password}" root chroot /d2a/work/archroot usermod -p "${encrypted_password}" root
@ -814,23 +815,17 @@ update_shadow_if_changed() {
local etcdir=$1/etc local etcdir=$1/etc
if [ -e ${etcdir}/shadow ]; then if [ -e ${etcdir}/shadow ]; then
# change password if file was touched # change password if file was touched
local shadow_line=$(awk -F: '$1 == "root" {print; exit}' ${etcdir}/shadow) local encrypted_password=$(awk -F: '$1 == "root" { print $2 }')
local shadow_array if [ "${encrypted_password}" != "x" ]; then
IFS=':' read -a shadow_array <<< "${shadow_line}" usermod -p "${encrypted_password}" root
if [ ${#shadow_array[@]} -ge 3 ]; then if [ ${#encrypted_password} -gt 1 ]; then
local encrypted_password=${shadow_array[1]} chage -d 0 root
local last_changed=${shadow_array[2]}
if [ "${last_changed}" != "1" ]; then
usermod -p "${encrypted_password}" root
if [ ${#encrypted_password} -gt 1 ]; then
chage -d 0 root
fi
fi fi
fi fi
fi fi
cat > ${etcdir}/shadow <<-EOF cat > ${etcdir}/shadow <<-EOF
root:*:1:::::: root:x:1::::::
nobody:*:1:::::: nobody:x:1::::::
EOF EOF
chmod 0600 ${etcdir}/shadow chmod 0600 ${etcdir}/shadow
} }
@ -937,7 +932,7 @@ ExecStart=/usr/sbin/digitalocean-synchronize
!!!!digitalocean-synchronize.PKGINFO !!!!digitalocean-synchronize.PKGINFO
pkgname = digitalocean-synchronize pkgname = digitalocean-synchronize
pkgver = 2.0-1 pkgver = 2.1-1
pkgdesc = DigitalOcean Synchronization (passwords, keys, networks) pkgdesc = DigitalOcean Synchronization (passwords, keys, networks)
url = https://github.com/gh2o/digitalocean-debian-to-arch url = https://github.com/gh2o/digitalocean-debian-to-arch
arch = any arch = any