diff --git a/debian/chroot.install b/debian/chroot.install index 3711e09..f7b6f1a 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -30,13 +30,13 @@ RESET='\033[0m' ## }}} ## Package to exclude from debootstrap install -dbs_pkg_exclude="vim" +dbs_pkg_exclude="vim-tiny" ## Package to include to debootstrap install dbs_pkg_include="aptitude,bzip2,debconf-i18n,dialog,dmsetup,htop,isc-dhcp-client,isc-dhcp-common,locales,lvm2,openssh-server,pciutils,tmux,vim-nox,wget,zsh" # Prepare host system {{{ apt update -apt install coreutils debootstrap e2fsprogs gawk ipcalc lvm2 parted util-linux wget +apt install -y coreutils debootstrap e2fsprogs gawk ipcalc lvm2 parted util-linux wget # }}} # Partitionning {{{ if [ "${manage_part}" -eq 0 ]; then @@ -52,7 +52,7 @@ if [ "${manage_part}" -eq 0 ]; then parted "${hdd}" mkpart primary 0% 512MB parted "${hdd}" set 1 boot on ### LV - parted "${hdd}" mkpart primary 4194kB 100% + parted "${hdd}" mkpart primary 512MB 100% parted "${hdd}" set 2 lvm on sudo pvcreate "${hdd}"2 sudo vgcreate "${vgname}" "${hdd}"2 @@ -127,59 +127,6 @@ debootstrap --arch amd64 --include="${dbs_pkg_include}" --exclude="${dbs_pkg_exc # }}} # Configure system {{{ -## Create the disk/partitions (eg. /dev/sda, /dev/sda1,…) on the target system {{{ -### Create the disk -[ -b /target"${hdd}" ] || mknod --mode=660 /target"${hdd}" b 8 0 - -### Count the number of partitions on the rescue system -nb_part=$(ls -l -- "${hdd}"? | wc -l) -part=1 -### Start at 1 and less/equal $nb_part -while [ "${part}" -le "${nb_part}" ]; do - #### Create the partitions on the target system - [ -b /target"${hdd}${part}" ] || mknod --mode=660 /target"${hdd}${part}" b 8 "${part}" - (( part++ )) -done - -### Fix group of disk/partitions -chgrp disk -- /target"${hdd}"* -## }}} -## Create LV inodes {{{ -### Count the number of LV on the rescue system -nb_lv=$(ls -l -- /dev/dm-* | wc -l) -lv=0 -### Start at 0 and less than $nb_lv cause it start at 0 -while [ "${lv}" -lt "${nb_lv}" ]; do - #### Create the LV on the target system - [ -b /target/dev/dm-"${lv}" ] || mknod --mode=660 /target/dev/dm-"${lv}" b 252 "${lv}" - (( lv++ )) -done - -### Fix group of LV -chgrp disk -- /target/dev/dm-* -## }}} -## Create symlinks to LV {{{ -### Get the list of all LV -tmp_list_lv="/tmp/lv.rescue.list" -find /dev/"${vgname}" -maxdepth 1 -type l -printf "%f\\n" > "${tmp_list_lv}" - -### Create Volume Group and mapper directories -mkdir -p -- /target/dev/"${vgname}" -mkdir -p -- /target/dev/mapper - -### For each LV -while IFS= read -r LV_NAME -do - - #### Create symlink in Volume Group directory on the target system (eg. /dev/mapper/ovhsys/home -> ../dm-0) - [ -L /target/dev/"${vgname}/${LV_NAME}" ] || ln -fs -- $(readlink /dev/"${vgname}/${LV_NAME}") /target/dev/"${vgname}/${LV_NAME}" - - #### Create symlink in mapper directory on the target system (eg. /dev/mapper/mapper/ovhsys-home -> ../dm-0) - [ -L /target/dev/mapper/"${vgname}-${LV_NAME}" ] || ln -fs -- $(readlink /dev/"${vgname}/${LV_NAME}") /target/dev/mapper/"${vgname}-${LV_NAME}" -done < "${tmp_list_lv}" -rm -f -- "${tmp_list_lv}" - -## }}} ## Fstab {{{ ### Use the current mtab content as default fstab file for the target system grep target /etc/mtab | grep -vE '(tmpfs|pts|proc|sysfs)' > /target/etc/fstab