From c193f1ce7530e05d95fdbbe13c531f31cabd2e23 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 22 Aug 2013 13:20:57 +0200
Subject: [PATCH] installer.sh: literally copy live rootfs to the targetdir and
 cleanup.

---
 installer.sh.in | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/installer.sh.in b/installer.sh.in
index 43aa6c3..b628849 100644
--- a/installer.sh.in
+++ b/installer.sh.in
@@ -707,19 +707,9 @@ umount_filesystems() {
     umount $TARGETDIR >$LOG 2>&1
 }
 
-install_packages() {
-    local _grub=
-
-    if [ -n "$EFI_SYSTEM" ]; then
-        _grub="grub-x86_64-efi"
-    else
-        _grub="grub"
-    fi
-
-    mkdir -p $TARGETDIR/boot/grub
-    stdbuf -oL xbps-install -C /tmp/xbps.conf \
-        -r $TARGETDIR -Sy base-system ${_grub} 2>&1 | \
-        DIALOG --title "Installing base system packages..." \
+copy_rootfs() {
+    LANG=C cp -axvn / $TARGETDIR 2>&1 | \
+        DIALOG --title "Copyring live image to target rootfs ..." \
         --programbox 24 80
     if [ $? -ne 0 ]; then
         DIE 1
@@ -765,7 +755,13 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
         enable_localsrc
     fi
     # Install required packages.
-    install_packages
+    copy_rootfs
+    # Disable autologin and remove motd from live image.
+    rm -f $TARGETDIR/etc/motd $TARGETDIR/etc/systemd/system/getty@.service
+    # Remove live user.
+    . /etc/default/live.conf
+    echo "Removing $USERNAME live user from targetdir ..." >$LOG
+    chroot $TARGETDIR userdel -r $USERNAME >>$LOG 2>&1
 
     DIALOG --infobox "Applying installer settings..." 4 60