From 5e0951d8cbcbdf5bdbc64ef63a299ffecca55f84 Mon Sep 17 00:00:00 2001 From: Antynea Date: Sat, 29 Aug 2015 23:17:03 +0200 Subject: [PATCH 1/5] Fixme : broken $boot_dir_real_path Fixme : broken $boot_dir_real_path --- 41_snapshots-btrfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 5943cc2..ea85f3d 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -90,7 +90,6 @@ boot_dir() boot_dir="$gbgmp/$snap_dir_name/boot" [[ "$root_uuid" != "$boot_uuid" ]] && boot_dir="/boot" echo "$boot_dir" - if [ -d ${boot_dir} ]; then boot_dir_real_path="$(make_system_path_relative_to_its_root "$boot_dir")"; fi } @@ -202,6 +201,7 @@ list_kernels_initramfs() detect_initramfs name_initramfs=("${list_initramfs[@]##*"/"}") # echo "initramfs = ${name_initramfs[*]}" + if [ -d ${boot_dir} ]; then boot_dir_real_path="$(make_system_path_relative_to_its_root "$(boot_dir)")"; fi # Create menu entries snapshots_entry "${prefixentry}" "${snap_dir_name}" "${snap_date_time}" done @@ -220,4 +220,4 @@ if [ ${choise_of_method} = "1" ] ; then umount $gbgmp gettext_printf "###### - Grub-btrfs: Auto-detect - ######\n" >&2 ; fi -### End choice of method ### \ No newline at end of file +### End choice of method ### From 3a7c6abece7408165cac265cdae38de9d8fa6431 Mon Sep 17 00:00:00 2001 From: Antynea Date: Sat, 29 Aug 2015 23:45:32 +0200 Subject: [PATCH 2/5] fixme : detect microcode fixme : detect microcode --- 41_snapshots-btrfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index ea85f3d..84efefd 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -123,7 +123,7 @@ snapshots_entry() echo 'Loading Kernel: "${k}" ...' linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters} echo 'Loading Initramfs: "${i}" ...'" - if [ -f "/${boot_dir_real_path}/"${microcode}"" ] ; then + if [ -f "$(boot_dir)/${microcode}" ] ; then echo "\ initrd \"${boot_dir_real_path}/"${microcode}"\" initrd \"/${snap_dir_name}/boot/"${i}"\"" else From 31a0baa2b1a8a5e1620bc61f63bbc0ead31a5666 Mon Sep 17 00:00:00 2001 From: Antynea Date: Sun, 30 Aug 2015 00:15:15 +0200 Subject: [PATCH 3/5] redundancy test redundancy test --- 41_snapshots-btrfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 84efefd..b78fbf8 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -201,7 +201,7 @@ list_kernels_initramfs() detect_initramfs name_initramfs=("${list_initramfs[@]##*"/"}") # echo "initramfs = ${name_initramfs[*]}" - if [ -d ${boot_dir} ]; then boot_dir_real_path="$(make_system_path_relative_to_its_root "$(boot_dir)")"; fi + boot_dir_real_path="$(make_system_path_relative_to_its_root "$(boot_dir)")" # Create menu entries snapshots_entry "${prefixentry}" "${snap_dir_name}" "${snap_date_time}" done From b925f639cd122372314e8f3a9bf30365294d6800 Mon Sep 17 00:00:00 2001 From: Antynea Date: Sun, 30 Aug 2015 01:19:25 +0200 Subject: [PATCH 4/5] fixme : detect snapshot name with spaces fixme : detect snapshot name with spaces --- 41_snapshots-btrfs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index b78fbf8..3875f52 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -119,13 +119,13 @@ snapshots_entry() else search --no-floppy --fs-uuid --set=root ${boot_uuid} fi - echo 'Loading Snapshot: "${snap_dir_name}" "${snap_date_time}"' + echo 'Loading Snapshot: "${2}" "${3}"' echo 'Loading Kernel: "${k}" ...' linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters} echo 'Loading Initramfs: "${i}" ...'" if [ -f "$(boot_dir)/${microcode}" ] ; then echo "\ - initrd \"${boot_dir_real_path}/"${microcode}"\" initrd \"/${snap_dir_name}/boot/"${i}"\"" + initrd \"${boot_dir_real_path}/"${microcode}"\" initrd \"/"${snap_dir_name}"/boot/"${i}"\"" else echo "\ initrd \"${boot_dir_real_path}/"${i}"\"" @@ -144,7 +144,7 @@ snapshot_list() snap=($snap) local snap_path_name=${snap[@]:13:${#snap[@]}} # Discard deleted snapshots - if [ $snap_path_name = "DELETED" ]; then continue; fi + if [ "$snap_path_name" = "DELETED" ]; then continue; fi [[ ${snap_path_name%%"/"*} == "" ]] && snap_path_name=${snap_path_name#*"/"} echo ${snap[@]:10:2} ${snap_path_name} done @@ -153,14 +153,14 @@ snapshot_list() detect_kernel() { ## Arch original kernel (auto-detect) - for akernel in $(boot_dir)/vmlinuz-* ; do + for akernel in "$(boot_dir)"/vmlinuz-* ; do list_kernel+=("$akernel") done ## Custom name kernel in GRUB_BTRFS_NKERNEL if [ ! -z ${nkernel} ] ; then for ckernel in "${nkernel[@]}" ; do - [[ ! -f /$(boot_dir)/${ckernel} ]] && continue; + [[ ! -f /"$(boot_dir)/${ckernel}" ]] && continue; list_kernel+=("$ckernel") done fi @@ -169,14 +169,14 @@ detect_kernel() detect_initramfs() { ## Arch original initramfs (auto-detect) - for ainitramfs in $(boot_dir)/initramfs-* ; do + for ainitramfs in "$(boot_dir)"/initramfs-* ; do list_initramfs+=("$ainitramfs") done ## Custom name initramfs in GRUB_BTRFS_NINIT if [ ! -z ${ninit} ] ; then for cinitramfs in "${ninit[@]}" ; do - [[ ! -f /$(boot_dir)/${ninit} ]] && continue; + [[ ! -f "/$(boot_dir)/${ninit}" ]] && continue; list_initramfs+=("$ninit") done fi From d5985290012a09c459b919e4243b80de202a91d5 Mon Sep 17 00:00:00 2001 From: Antynea Date: Sun, 30 Aug 2015 02:23:18 +0200 Subject: [PATCH 5/5] fixme : detect kernesl and initramfs with spaces fixme : detect kernel and initramfs with spaces --- 41_snapshots-btrfs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 3875f52..20b398a 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -158,9 +158,9 @@ detect_kernel() done ## Custom name kernel in GRUB_BTRFS_NKERNEL - if [ ! -z ${nkernel} ] ; then + if [ ! -z "${nkernel}" ] ; then for ckernel in "${nkernel[@]}" ; do - [[ ! -f /"$(boot_dir)/${ckernel}" ]] && continue; + [[ ! -f /"$(boot_dir)"/"${ckernel}" ]] && continue; list_kernel+=("$ckernel") done fi @@ -174,10 +174,10 @@ detect_initramfs() done ## Custom name initramfs in GRUB_BTRFS_NINIT - if [ ! -z ${ninit} ] ; then + if [ ! -z "$ninit" ] ; then for cinitramfs in "${ninit[@]}" ; do - [[ ! -f "/$(boot_dir)/${ninit}" ]] && continue; - list_initramfs+=("$ninit") + [[ ! -f /"$(boot_dir)"/"${cinitramfs}" ]] && continue; + list_initramfs+=("$cinitramfs") done fi }