summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alis-recovery.sh28
-rw-r--r--alis.sh48
-rw-r--r--packer/alis-packer-efi-btrfs-luks-lvm-systemd-aur.json3
-rw-r--r--packer/alis-packer-efi-ext4-grub-gnome.json3
-rw-r--r--packer/alis-packer-efi-ext4-grub-kde.json3
-rw-r--r--packer/alis-packer-efi-ext4-grub-xfce.json3
-rw-r--r--packer/alis-packer-efi-ext4-luks-grub.json52
-rw-r--r--packer/alis-packer-efi-ext4-luks-lvm-grub.json3
8 files changed, 103 insertions, 40 deletions
diff --git a/alis-recovery.sh b/alis-recovery.sh
index 65622bc..99ed8eb 100644
--- a/alis-recovery.sh
+++ b/alis-recovery.sh
@@ -50,7 +50,8 @@ PARTITION_BIOS=""
PARTITION_BOOT=""
PARTITION_ROOT=""
DEVICE_ROOT=""
-LVM_VOLUME_PHISICAL="lvm"
+DEVICE_LVM=""
+LUKS_DEVICE_NAME="cryptroot"
LVM_VOLUME_GROUP="vg"
LVM_VOLUME_LOGICAL="root"
BOOT_DIRECTORY=""
@@ -222,16 +223,17 @@ function prepare_partition() {
umount /mnt/boot
umount /mnt
fi
- if [ -e "/dev/mapper/$LVM_VOLUME_LOGICAL" ]; then
- if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
- cryptsetup close $LVM_VOLUME_LOGICAL
- fi
+ if [ -e "/dev/mapper/$LVM_VOLUME_GROUP-$LVM_VOLUME_LOGICAL" ]; then
+ lvremove --force "$LVM_VOLUME_GROUP-$LVM_VOLUME_LOGICAL"
fi
- if [ -e "/dev/mapper/$LVM_VOLUME_PHISICAL" ]; then
- if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
- cryptsetup close $LVM_VOLUME_PHISICAL
- fi
+ if [ -e "/dev/mapper/$LVM_VOLUME_GROUP" ]; then
+ vgremove --force "/dev/mapper/$LVM_VOLUME_GROUP"
+ pvremove "/dev/mapper/$LUKS_DEVICE_NAME"
+ fi
+ if [ -e "/dev/mapper/$LUKS_DEVICE_NAME" ]; then
+ cryptsetup close $LUKS_DEVICE_NAME
fi
+ partprobe $DEVICE
}
function configure_network() {
@@ -313,13 +315,15 @@ function partition() {
# luks and lvm
if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
- echo -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" | cryptsetup --key-file=- open $PARTITION_ROOT $LVM_VOLUME_PHISICAL
+ echo -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" | cryptsetup --key-file=- open $PARTITION_ROOT $LUKS_DEVICE_NAME
sleep 5
fi
+ if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
+ DEVICE_ROOT="/dev/mapper/$LUKS_DEVICE_NAME"
+ fi
if [ "$LVM" == "true" ]; then
- DEVICE_ROOT_MAPPER="$LVM_VOLUME_GROUP-$LVM_VOLUME_LOGICAL"
- DEVICE_ROOT="/dev/mapper/$DEVICE_ROOT_MAPPER"
+ DEVICE_ROOT="/dev/mapper/$LVM_VOLUME_GROUP-$LVM_VOLUME_LOGICAL"
fi
PARTITION_OPTIONS="defaults"
diff --git a/alis.sh b/alis.sh
index 5fdb2aa..be1818e 100644
--- a/alis.sh
+++ b/alis.sh
@@ -46,8 +46,8 @@ PARTITION_BIOS=""
PARTITION_BOOT=""
PARTITION_ROOT=""
DEVICE_ROOT=""
-LVM_DEVICE=""
-LVM_VOLUME_PHISICAL="lvm"
+DEVICE_LVM=""
+LUKS_DEVICE_NAME="cryptroot"
LVM_VOLUME_GROUP="vg"
LVM_VOLUME_LOGICAL="root"
SWAPFILE=""
@@ -301,18 +301,15 @@ function prepare_partition() {
umount /mnt/boot
umount /mnt
fi
- if [ -e "/dev/mapper/$LVM_VOLUME_LOGICAL" ]; then
- if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
- cryptsetup close $LVM_VOLUME_LOGICAL
- fi
- fi
- if [ -e "/dev/mapper/$LVM_VOLUME_PHISICAL" ]; then
+ if [ -e "/dev/mapper/$LVM_VOLUME_GROUP-$LVM_VOLUME_LOGICAL" ]; then
lvremove --force "$LVM_VOLUME_GROUP-$LVM_VOLUME_LOGICAL"
+ fi
+ if [ -e "/dev/mapper/$LVM_VOLUME_GROUP" ]; then
vgremove --force "/dev/mapper/$LVM_VOLUME_GROUP"
- pvremove "/dev/mapper/$LVM_VOLUME_PHISICAL"
- if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
- cryptsetup close $LVM_VOLUME_PHISICAL
- fi
+ pvremove "/dev/mapper/$LUKS_DEVICE_NAME"
+ fi
+ if [ -e "/dev/mapper/$LUKS_DEVICE_NAME" ]; then
+ cryptsetup close $LUKS_DEVICE_NAME
fi
partprobe $DEVICE
}
@@ -442,22 +439,27 @@ function partition() {
# luks and lvm
if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
- LVM_DEVICE="/dev/mapper/$LVM_VOLUME_PHISICAL"
- else
- LVM_DEVICE="$PARTITION_ROOT"
- fi
-
- if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
echo -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" | cryptsetup --key-size=512 --key-file=- luksFormat --type luks2 $PARTITION_ROOT
- echo -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" | cryptsetup --key-file=- open $PARTITION_ROOT $LVM_VOLUME_PHISICAL
+ echo -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" | cryptsetup --key-file=- open $PARTITION_ROOT $LUKS_DEVICE_NAME
sleep 5
fi
if [ "$LVM" == "true" ]; then
- pvcreate $LVM_DEVICE
- vgcreate $LVM_VOLUME_GROUP $LVM_DEVICE
+ if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
+ DEVICE_LVM="/dev/mapper/$LUKS_DEVICE_NAME"
+ else
+ DEVICE_LVM="$DEVICE_ROOT"
+ fi
+
+ pvcreate $DEVICE_LVM
+ vgcreate $LVM_VOLUME_GROUP $DEVICE_LVM
lvcreate -l 100%FREE -n $LVM_VOLUME_LOGICAL $LVM_VOLUME_GROUP
+ fi
+ if [ -n "$PARTITION_ROOT_ENCRYPTION_PASSWORD" ]; then
+ DEVICE_ROOT="/dev/mapper/$LUKS_DEVICE_NAME"
+ fi
+ if [ "$LVM" == "true" ]; then
DEVICE_ROOT="/dev/mapper/$LVM_VOLUME_GROUP-$LVM_VOLUME_LOGICAL"
fi
@@ -681,7 +683,7 @@ function virtualbox() {
print_step "virtualbox()"
if [ -z "$KERNELS" ]; then
- pacman_install "virtualbox-guest-utils virtualbox-guest-modules-arch"
+ pacman_install "virtualbox-guest-utils"
else
pacman_install "virtualbox-guest-utils virtualbox-guest-dkms"
fi
@@ -709,7 +711,7 @@ function bootloader() {
if [ "$DEVICE_TRIM" == "true" ]; then
BOOTLOADER_ALLOW_DISCARDS=":allow-discards"
fi
- CMDLINE_LINUX="cryptdevice=PARTUUID=$PARTUUID_ROOT:$LVM_VOLUME_PHISICAL$BOOTLOADER_ALLOW_DISCARDS"
+ CMDLINE_LINUX="cryptdevice=PARTUUID=$PARTUUID_ROOT:$LUKS_DEVICE_NAME$BOOTLOADER_ALLOW_DISCARDS"
fi
if [ "$FILE_SYSTEM_TYPE" == "btrfs" ]; then
CMDLINE_LINUX="$CMDLINE_LINUX rootflags=subvol=root"
diff --git a/packer/alis-packer-efi-btrfs-luks-lvm-systemd-aur.json b/packer/alis-packer-efi-btrfs-luks-lvm-systemd-aur.json
index d502146..aa43597 100644
--- a/packer/alis-packer-efi-btrfs-luks-lvm-systemd-aur.json
+++ b/packer/alis-packer-efi-btrfs-luks-lvm-systemd-aur.json
@@ -1,5 +1,6 @@
{
"variables": {
+ "iso": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.05.01-x86_64.iso",
"disk_size": "16384"
},
"builders": [
@@ -18,7 +19,7 @@
],
"disk_size": "{{user `disk_size`}}",
"hard_drive_interface": "sata",
- "iso_url": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.03.01-x86_64.iso",
+ "iso_url": "{{user `iso`}}",
"iso_checksum": "69f18631dd1518e1efa596497399d668e6fc63e6",
"iso_checksum_type": "sha1",
"ssh_username": "vagrant",
diff --git a/packer/alis-packer-efi-ext4-grub-gnome.json b/packer/alis-packer-efi-ext4-grub-gnome.json
index de59352..d42bc1f 100644
--- a/packer/alis-packer-efi-ext4-grub-gnome.json
+++ b/packer/alis-packer-efi-ext4-grub-gnome.json
@@ -1,5 +1,6 @@
{
"variables": {
+ "iso": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.05.01-x86_64.iso",
"disk_size": "16384"
},
"builders": [
@@ -18,7 +19,7 @@
],
"disk_size": "{{user `disk_size`}}",
"hard_drive_interface": "sata",
- "iso_url": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.03.01-x86_64.iso",
+ "iso_url": "{{user `iso`}}",
"iso_checksum": "69f18631dd1518e1efa596497399d668e6fc63e6",
"iso_checksum_type": "sha1",
"ssh_username": "vagrant",
diff --git a/packer/alis-packer-efi-ext4-grub-kde.json b/packer/alis-packer-efi-ext4-grub-kde.json
index 9318112..8e49d5b 100644
--- a/packer/alis-packer-efi-ext4-grub-kde.json
+++ b/packer/alis-packer-efi-ext4-grub-kde.json
@@ -1,5 +1,6 @@
{
"variables": {
+ "iso": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.05.01-x86_64.iso",
"disk_size": "16384"
},
"builders": [
@@ -18,7 +19,7 @@
],
"disk_size": "{{user `disk_size`}}",
"hard_drive_interface": "sata",
- "iso_url": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.03.01-x86_64.iso",
+ "iso_url": "{{user `iso`}}",
"iso_checksum": "69f18631dd1518e1efa596497399d668e6fc63e6",
"iso_checksum_type": "sha1",
"ssh_username": "vagrant",
diff --git a/packer/alis-packer-efi-ext4-grub-xfce.json b/packer/alis-packer-efi-ext4-grub-xfce.json
index e8c11d6..2c6b13f 100644
--- a/packer/alis-packer-efi-ext4-grub-xfce.json
+++ b/packer/alis-packer-efi-ext4-grub-xfce.json
@@ -1,5 +1,6 @@
{
"variables": {
+ "iso": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.05.01-x86_64.iso",
"disk_size": "16384"
},
"builders": [
@@ -18,7 +19,7 @@
],
"disk_size": "{{user `disk_size`}}",
"hard_drive_interface": "sata",
- "iso_url": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.03.01-x86_64.iso",
+ "iso_url": "{{user `iso`}}",
"iso_checksum": "69f18631dd1518e1efa596497399d668e6fc63e6",
"iso_checksum_type": "sha1",
"ssh_username": "vagrant",
diff --git a/packer/alis-packer-efi-ext4-luks-grub.json b/packer/alis-packer-efi-ext4-luks-grub.json
new file mode 100644
index 0000000..811c4bc
--- /dev/null
+++ b/packer/alis-packer-efi-ext4-luks-grub.json
@@ -0,0 +1,52 @@
+{
+ "variables": {
+ "iso": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.05.01-x86_64.iso",
+ "disk_size": "16384"
+ },
+ "builders": [
+ {
+ "name": "archlinux-alis-virtualbox",
+ "type": "virtualbox-iso",
+ "guest_os_type": "ArchLinux_64",
+ "guest_additions_mode": "attach",
+ "headless": false,
+ "http_directory": ".",
+ "vboxmanage": [
+ ["modifyvm", "{{.Name}}", "--memory", "2048"],
+ ["modifyvm", "{{.Name}}", "--vram", "128"],
+ ["modifyvm", "{{.Name}}", "--cpus", "2"],
+ ["modifyvm", "{{.Name}}", "--firmware", "efi"]
+ ],
+ "disk_size": "{{user `disk_size`}}",
+ "hard_drive_interface": "sata",
+ "iso_url": "{{user `iso`}}",
+ "iso_checksum": "69f18631dd1518e1efa596497399d668e6fc63e6",
+ "iso_checksum_type": "sha1",
+ "ssh_username": "vagrant",
+ "ssh_password": "vagrant",
+ "ssh_wait_timeout": "60m",
+ "boot_wait": "5s",
+ "boot_command": [
+ "<wait30s>",
+ "wget http://{{.HTTPIP}}:{{.HTTPPort}}/alis.conf<enter><wait1s>",
+ "wget http://{{.HTTPIP}}:{{.HTTPPort}}/alis.sh<enter><wait1s>",
+ "sed -i \"s/FILE_SYSTEM_TYPE=.*/FILE_SYSTEM_TYPE=\\\"ext4\\\"/\" ./alis.conf<enter><wait1s>",
+ "sed -i \"s/LVM=.*/LVM=\\\"false\\\"/\" ./alis.conf<enter><wait1s>",
+ "sed -i \"s/PARTITION_ROOT_ENCRYPTION_PASSWORD=.*/PARTITION_ROOT_ENCRYPTION_PASSWORD=\\\"archlinux\\\"/\" ./alis.conf<enter><wait1s>",
+ "sed -i \"s/PARTITION_ROOT_ENCRYPTION_PASSWORD_RETYPE=.*/PARTITION_ROOT_ENCRYPTION_PASSWORD_RETYPE=\\\"archlinux\\\"/\" ./alis.conf<enter><wait1s>",
+ "sed -i \"s/BOOTLOADER=.*/BOOTLOADER=\\\"grub\\\"/\" ./alis.conf<enter><wait1s>",
+ "sed -i \"s/DESKTOP_ENVIRONMENT=.*/DESKTOP_ENVIRONMENT=\\\"\\\"/\" ./alis.conf<enter><wait1s>",
+ "chmod +x ./alis.sh<enter><wait1s>",
+ "./alis.sh<enter><wait3>y<wait1s><enter>",
+ "<wait10s><wait10s><wait10s><wait10s><wait10s><wait10s><wait10s><wait60m>"
+ ],
+ "shutdown_command": "systemctl poweroff"
+ }
+ ],
+ "post-processors": [
+ {
+ "type": "vagrant",
+ "output": "archlinux-alis-{{.BuildName}}.box"
+ }
+ ]
+ } \ No newline at end of file
diff --git a/packer/alis-packer-efi-ext4-luks-lvm-grub.json b/packer/alis-packer-efi-ext4-luks-lvm-grub.json
index 9baf5fa..90e6d10 100644
--- a/packer/alis-packer-efi-ext4-luks-lvm-grub.json
+++ b/packer/alis-packer-efi-ext4-luks-lvm-grub.json
@@ -1,5 +1,6 @@
{
"variables": {
+ "iso": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.05.01-x86_64.iso",
"disk_size": "16384"
},
"builders": [
@@ -18,7 +19,7 @@
],
"disk_size": "{{user `disk_size`}}",
"hard_drive_interface": "sata",
- "iso_url": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2020.03.01-x86_64.iso",
+ "iso_url": "{{user `iso`}}",
"iso_checksum": "69f18631dd1518e1efa596497399d668e6fc63e6",
"iso_checksum_type": "sha1",
"ssh_username": "vagrant",