From 713c8a80410e97f461e64cba52f2aa97294b6e4f Mon Sep 17 00:00:00 2001
From: jedi <git@m.j3d1.de>
Date: Thu, 6 Feb 2020 11:47:08 +0100
Subject: [PATCH] wip

---
 entry.sh | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/entry.sh b/entry.sh
index b48b0eb..6d44274 100755
--- a/entry.sh
+++ b/entry.sh
@@ -26,6 +26,8 @@ function first_stage(){
 	break
 	done
 	
+	export DEVICE
+	
 	apt install -y debootstrap cryptsetup btrfs-progs lvm2
 	
 	if [ -d /dev/vg0 ]; then
@@ -67,6 +69,7 @@ function first_stage(){
 	echo $LUKS_PASSWORD	
 	)| cryptsetup luksFormat ${DEVICE}2
 	echo $LUKS_PASSWORD | cryptsetup luksOpen ${DEVICE}2 cryptlvm
+	unset LUKS_PASSWORD
 	pvcreate /dev/mapper/cryptlvm
 	vgcreate vg0 /dev/mapper/cryptlvm
 	
@@ -100,14 +103,16 @@ function first_stage(){
 
 function second_stage(){
 	set -e
-	echo $TARGET
-	echo $LVM_SIZE
+	export DEBIAN_FRONTEND=noninteractive
 	(
 	echo $ROOT_PASSWORD
 	echo $ROOT_PASSWORD
 	) | passwd
+	unset ROOT_PASSWORD
 	echo -n > /etc/motd
-	apt install -y linux-image-amd64 grub2 cryptsetup btrfs-progs lvm2 locales tzdata keyboard-configuration console-common zsh
+	update_sources
+	apt install -y linux-image-amd64 grub2 cryptsetup btrfs-progs lvm2 firmware-iwlwifi locales tzdata keyboard-configuration console-common zsh
+	brub-install 
 	mkdir /snap
 	btrfs subvolume snapshot / /snap/$(date +%Y-%m-%d_basesystem)
 	apt install -y task-mate-desktop mate-desktop-environment-extra
@@ -120,6 +125,7 @@ function second_stage(){
 	echo
 	echo
 	) | adduser jedi
+	unset USER_PASSWORD
 	
 	HOME=/home/jedi
 	btrfs subvolume snapshot / /snap/$(date +%Y-%m-%d_user_gui)
@@ -139,3 +145,11 @@ function post_install_stage(){
         umount -l $LINE;
     done
 }
+
+function update_sources(){
+	if [ ! grep -Fxq "contrib" /etc/apt/sources.list ]
+	then
+		sed -i 's/main/main contrib non-free/g' /etc/apt/sources.list
+		apt update
+	fi
+}