summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xiso/mkiso.sh29
-rwxr-xr-xiso/root/installer.sh48
2 files changed, 55 insertions, 22 deletions
diff --git a/iso/mkiso.sh b/iso/mkiso.sh
index 84a9782..6fe2914 100755
--- a/iso/mkiso.sh
+++ b/iso/mkiso.sh
@@ -5,7 +5,9 @@ ISO_LABEL="XILINUX"
PUBLISHER="davidovski"
SYSLINUX_VER=6.04-pre1
-XI_ARGS="-yq"
+TO_MIRROR="file:///var/lib/xib/repo"
+
+XI_ARGS="-yv"
WORKDIR=/tmp/xiiso
@@ -20,9 +22,10 @@ grub_mod="all_video disk part_gpt part_msdos linux normal configfile search sear
mkdir -p $WORKDIR
create_basesystem () {
- xi $XI_ARGS sync
- xi $XI_ARGS -r "$chroot" bootstrap
- xi $XI_ARGS -r "$chroot" install "$iso_pkgs"
+ mkdir -p $chroot
+ xipkg $XI_ARGS sync
+ xipkg $XI_ARGS -r "$chroot" bootstrap
+ xipkg $XI_ARGS -r "$chroot" install "$iso_pkgs"
}
configure_system() {
@@ -117,8 +120,9 @@ EOF
}
build_iso () {
+ local name=${1:-netinst}
mksquashfs $chroot $isoroot/filesystem.squashfs -noappend -no-progress -e "/proc/*" -e "/dev/*" -e "/sys/*"
- xorrisofs -output ${ISO_NAME}.iso \
+ xorrisofs -output ${name}.iso \
-joliet \
-rational-rock \
-sysid LINUX \
@@ -136,9 +140,21 @@ build_iso () {
$isoroot
- printf "ISO written to $ISO_NAME.iso\n"
+ printf "ISO written to $name.iso\n"
}
+create_full_iso () {
+ xipkg $XI_ARGS -r $chroot mirror
+
+ cat > $chroot/etc/xipkg.conf << EOF
+include /etc/xipkg.d/default.conf
+sources {
+ local file:///var/lib/xipkg/mirror/
+}
+default_cmd install
+EOF
+ build_iso "full"
+}
[ "$#" = 0 ] && {
steps="
@@ -149,6 +165,7 @@ build_iso () {
install_syslinux
build_grub_efi
build_iso
+ create_full_iso
"
} || {
steps="$*"
diff --git a/iso/root/installer.sh b/iso/root/installer.sh
index de06852..d2654ac 100755
--- a/iso/root/installer.sh
+++ b/iso/root/installer.sh
@@ -9,6 +9,7 @@ DEBUG_MODE=false
logfile="installer.log"
default_packages="base xipkg dracut grub doas neofetch vim tzdata mksh"
additional_services="networkmanager xorg iwd"
+cmdline=""
OPT_KERNEL="linux-libre"
OPT_BOOTSYSTEM="efi"
@@ -45,7 +46,7 @@ list_disks () {
}
list_partitions () {
- ls $1*
+ lsblk $1 -nlp -o NAME
echo "none"
}
@@ -97,6 +98,8 @@ encrypt_disk () {
#dd if=/dev/zero of=/dev/mapper/to_be_wiped >> $logfile
#cryptsetup close to_be_wiped >> $logfile
+ default_packages="$default_packages crypsetup lvm2"
+
partition_disk $ROOT_DISK
enter_password "disk encryption password"
t_msg "Encrypting $ROOT_DISK.."
@@ -109,6 +112,11 @@ encrypt_disk () {
lvcreate -l 100%FREE xilinux -n root >> $logfile
+ uuid="$(blkid --probe --output value --match-tag UUID $SYS_PART)"
+
+ cmdline="rd.luks.uuid=luks-$uuid rd.lvm.lv=xilinux/root root=/dev/xilinux/root rootflags=rw,relatime"
+ default_packages="$default_packages lvm2 cryptsetup"
+
export SYS_PART=/dev/xilinux/root
return 0
}
@@ -119,12 +127,14 @@ partition_disks () {
local selected=$(echo $T_RESULT | cut -d' ' -f1)
export ROOT_DISK=$selected
- t_yesno "${BLUE}Use full disk encryption?" && {
- export OPT_ENCRYPTION="lvm-luks"
- encrypt_disk $ROOT_DISK
- return 0
- } || t_yesno "${BLUE}Auto-partition $selected disk?\n${RED}(Warning: existing data will be overwritten)" && {
- partition_disk $selected || return 1
+ t_yesno "${BLUE}Auto-partition $selected disk?\n${RED}(Warning: existing data will be overwritten)" && {
+ t_yesno "${BLUE}Use full disk encryption?" && {
+ export OPT_ENCRYPTION="lvm-luks"
+ encrypt_disk $ROOT_DISK
+ return 0
+ } || {
+ partition_disk $selected || return 1
+ }
} || {
cfdisk $selected && {
t_radio 'Select primary system partition' $(list_partitions $selected)
@@ -173,15 +183,17 @@ mount_disks () {
[ -b "$SYS_PART" ] && {
mount $SYS_PART $sysroot
+ true
} || {
t_prompt "${RED}No system partition is available!"
return 1
}
- echo "[efi] mounting $EFI_PART to $efi_mntpoint" >> $logfile
+ echo "[efi] mounting $EFI_PART to ${efi_mntpoint}" >> $logfile
[ -b "$EFI_PART" ] && {
mkdir -p $efi_mntpoint
mount $EFI_PART $efi_mntpoint
+ true
}
[ -b "$SWAP_PART" ] && swapon $SWAP_PART
@@ -217,6 +229,7 @@ copy_resolvconf () {
sync_system () {
t_msg "Syncing system..."
xichroot $sysroot xi sync >> $logfile
+ return 0
}
generate_fstab () {
@@ -229,7 +242,7 @@ build_initramfs () {
mkdir -p $sysroot/var/tmp
for kernel_version in $(ls $sysroot/usr/lib/modules); do
t_msg "Building initramfs for $kernel_version..."
- xichroot $sysroot dracut --kver $kernel_version 2>&1 >> $logfile
+ xichroot $sysroot dracut --kver $kernel_version 2>> $logfile >> $logfile
done
}
@@ -237,7 +250,7 @@ install_grub () {
t_yesno "Install grub?" && {
[ "$OPT_BOOTSYSTEM" = "efi" ] && {
target="x86_64-efi"
- opts="--target=$target --efi-directory=$efi_mntpoint"
+ opts="--target=$target --efi-directory=${efi_mntpoint#$sysroot}"
t_yesno "Install as removable system?" && opts="--removable $opts " || true
} || {
target="i386-pc"
@@ -245,9 +258,11 @@ install_grub () {
}
t_msg "Installing grub for target $target..."
+ echo "[grub] installing with $opts" >> $logfile
xichroot $sysroot grub-install $opts >> $logfile
t_msg "Creating grub configuration..."
+ sed -i "s@GRUB_CMDLINE_LINUX_DEFAULT=\".*\"@GRUB_CMDLINE_LINUX_DEFAULT=\"$cmdline\"@g" $sysroot/etc/default/grub
xichroot $sysroot grub-mkconfig -o /boot/grub/grub.cfg
t_prompt "Installed grub for $target"
@@ -374,6 +389,7 @@ service_xorg () {
t_msg "Installing xorg..."
xi -qvly -r $sysroot install base-xorg base-fonts >> $logfile
t_check "Select video drivers:" $(xi search xf86-video- | cut -f2 -d/)
+ t_msg "Installing $T_RESULT..."
[ "${#T_RESULT}" != "0" ] && xi -r $sysroot install $T_RESULT >> $logfile
t_prompt "Installed basic xorg functionality
TODO: preconfigured window managers, for now you need to configure them yourself"
@@ -394,7 +410,7 @@ umount_disks () {
t_msg "Unmounting disks..."
umount -R $sysroot
[ -b "$SWAP_PART" ] && swapoff $SWAP_PART
- [ "$OPT_ENCRYPTION" = "lvm-luks"] && cryptsetup close cryptlvm
+ [ "$OPT_ENCRYPTION" = "lvm-luks" ] && cryptsetup close cryptlvm
return 0
}
@@ -417,13 +433,12 @@ mount_disks
prompt_kernel
bootstrap_system
install_base
-copy_resolvconf
+build_initramfs
+install_grub
configure_hostname
select_timezone
-sync_system
+copy_resolvconf
generate_fstab
-build_initramfs
-install_grub
configure_users
fix_permissions
install_additional
@@ -444,8 +459,9 @@ $DEBUG_MODE && {
for step in $steps; do
t_cls_ptrn
+ echo "[installer] doing step $step" >> $logfile
$step 2>> $logfile || {
- t_prompt "${RED}An error occured!"
+ t_prompt "${RED}An error occurred!"
t_clean
exit 1
}