refactor functions, try to put more config into pre-transitory

This commit is contained in:
gh2o 2014-07-13 17:38:33 -07:00
parent 1344d5f674
commit 8128439971
1 changed files with 18 additions and 5 deletions

View File

@ -151,23 +151,27 @@ extract_packages() {
done done
} }
configure_and_bootstrap() { mount_virtuals() {
log "Mounting virtual filesystems ..." log "Mounting virtual filesystems ..."
mount -t proc proc /archroot/proc mount -t proc proc /archroot/proc
mount -t sysfs sys /archroot/sys mount -t sysfs sys /archroot/sys
mount --bind /dev /archroot/dev mount --bind /dev /archroot/dev
mount -t devpts pts /archroot/dev/pts mount -t devpts pts /archroot/dev/pts
}
log "Doing initial configuration ..." prebootstrap_configuration() {
log "Doing pre-bootstrap configuration ..."
rmdir /archroot/var/cache/pacman/pkg rmdir /archroot/var/cache/pacman/pkg
ln -s ../../../packages /archroot/var/cache/pacman/pkg ln -s ../../../packages /archroot/var/cache/pacman/pkg
chroot /archroot /usr/bin/update-ca-certificates --fresh chroot /archroot /usr/bin/update-ca-certificates --fresh
}
bootstrap_system() {
local shouldbootstrap=false isbootstrapped=false local shouldbootstrap=false isbootstrapped=false
while ! $isbootstrapped; do while ! $isbootstrapped; do
if $shouldbootstrap; then if $shouldbootstrap; then
log "Initial bootstrap ..." log "Bootstrapping system ..."
chroot /archroot pacman-key --init chroot /archroot pacman-key --init
chroot /archroot pacman-key --populate archlinux chroot /archroot pacman-key --populate archlinux
chroot /archroot pacman -Sy --force --noconfirm base openssh kexec-tools chroot /archroot pacman -Sy --force --noconfirm base openssh kexec-tools
@ -185,6 +189,10 @@ configure_and_bootstrap() {
} }
postbootstrap_configuration() {
log "Doing post-bootstrap configuration ..."
}
error_occurred() { error_occurred() {
log "Error occurred. Exiting." log "Error occurred. Exiting."
} }
@ -228,7 +236,10 @@ installer_main() {
download_packages download_packages
extract_packages extract_packages
configure_and_bootstrap mount_virtuals
prebootstrap_configuration
bootstrap_system
postbootstrap_configuration
# prepare for transtiory_main # prepare for transtiory_main
mv /sbin/init /sbin/init.original mv /sbin/init /sbin/init.original
@ -343,6 +354,8 @@ Gateway=${gateway}
DNS=8.8.8.8 DNS=8.8.8.8
DNS=8.8.4.4 DNS=8.8.4.4
EOF EOF
# enable networkd
systemctl enable systemd-networkd systemctl enable systemd-networkd
systemctl start systemd-networkd systemctl start systemd-networkd