about summary refs log tree commit diff stats
path: root/core/scripts/setup-target.sh
diff options
context:
space:
mode:
Diffstat (limited to 'core/scripts/setup-target.sh')
-rwxr-xr-xcore/scripts/setup-target.sh55
1 files changed, 30 insertions, 25 deletions
diff --git a/core/scripts/setup-target.sh b/core/scripts/setup-target.sh
index ecbe018..69b8640 100755
--- a/core/scripts/setup-target.sh
+++ b/core/scripts/setup-target.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 
-DEV=/dev
+DEV=/dev/sda
+VG=vg_system
 
 SETUP_TARGET="print"
 CHROOT="/mnt"
@@ -13,22 +14,21 @@ SCRIPTPATH=$(dirname "$SCRIPT")
 DIR=$(dirname "$SCRIPTPATH");
 DIR_LOCAL="$(dirname $(dirname ${DIR}))/local";
 
-ISO_FILE="${DIR_LOCAL}/crux-3.4.iso"
-
 ##read BLK_EFI
 BLK_EFI="${DEV}2"
 ##read BLK_BOOT
 BLK_BOOT="${DEV}3"
 ##read BLK_ROOT
-BLK_ROOT="${DEV}4"
+BLK_CRYPT="${DEV}4"
+BLK_ROOT="/dev/$VG/lv_root"
 ##read BLK_VAR
-BLK_VAR="${DEV}5"
+BLK_VAR="/dev/${VG}/lv_var"
 ##read BLK_USR
-BLK_USR="${DEV}6"
+#BLK_USR="${DEV}6"
 ##read BLK_SWP
-BLK_SWP="${DEV}7"
+BLK_SWP="/dev/${VG}/lv_swap"
 ##read BLK_HOME
-BLK_HOME="${DEV}8"
+BLK_HOME="/dev/${VG}/lv_home"
 
 
 # First we define the function
@@ -64,16 +64,21 @@ partition_target () {
         set 2 boot on \
         mkpart primary ext4 125 1128 \
         name 3 boot \
-        mkpart primary ext4 1128 5128 \
-        name 4 root \
-        mkpart primary ext4 5128 6128 \
-        name 5 var \
-        mkpart primary ext4 6128 14128 \
-        name 6 usr \
-        mkpart primary linux-swap 14128 18128 \
-        name 7 swap \
-        mkpart primary ext4 18128 100% \
-        name 8 home
+        mkpart primary 1128 100% \
+        set 4 lvm on
+
+    modprobe dm-crypt
+    cryptsetup luksFormat ${BLK_CRYPT}
+    cryptsetup luksOpen ${BLK_CRYPT} cryptlvm
+
+    pvcreate /dev/mapper/cryptlvm
+    vgcreate ${VG} /dev/mapper/cryptlvm
+
+    lvcreate -L 20G -n lv_root ${VG}
+    lvcreate -L 4G -n lv_var ${VG}
+    lvcreate -L 8G -n lv_swap ${VG}
+    lvcreate -L 120G -n lv_home ${VG}
+
 }
 
 mount_target () {
@@ -85,8 +90,8 @@ mount_target () {
     mkfs.ext4 $BLK_ROOT
     echo "1.1.2 Creating File System on $BLK_VAR with ext4:"
     mkfs.ext4 $BLK_VAR
-    echo "1.1.2 Creating File System on $BLK_USR with ext4:"
-    mkfs.ext4 $BLK_USR
+    #echo "1.1.2 Creating File System on $BLK_USR with ext4:"
+    #mkfs.ext4 $BLK_USR
     echo "1.1.2 Creating Swap File System on $BLK_SWP:"
     mkswap $BLK_SWP
     echo "1.1.2 Creating File System on $BLK_HOME with ext4:"
@@ -104,8 +109,8 @@ mount_target () {
     mkdir -p $CHROOT/var
     mount $BLK_VAR $CHROOT/var
 
-    mkdir -p $CHROOT/usr
-    mount $BLK_USR $CHROOT/usr
+    #mkdir -p $CHROOT/usr
+    #mount $BLK_USR $CHROOT/usr
 
     mkdir -p $CHROOT/home
     mount $BLK_HOME $CHROOT/home
@@ -152,16 +157,16 @@ enable_target () {
 print_target() {
     echo "Device: $DEV"
     echo "CHROOT: $CHROOT"
-    echo "ISO_FILE: $ISO_FILE"
-    echo "Option Selected: $SETUP_TARGET\n"
+    echo "Option Selected: $SETUP_TARGET"
 
     echo "1.1.2 EFI block; ($BLK_EFI)"
     echo "1.1.2 boot block; ($BLK_BOOT)"
+    echo "1.1.2 cryptlvm block; ($BLK_CRYPT)"
     echo "1.1.2 root block; ($BLK_ROOT)"
     echo "1.1.2 var block; ($BLK_VAR)"
     echo "1.1.2 usr block; ($BLK_USR)"
     echo "1.1.2 swap block; ($BLK_SWP)"
-    echo "1.1.2 home block; ($BLK_HOME)\n"
+    echo "1.1.2 home block; ($BLK_HOME)"
 
 
 }