From 93b8ac07f5fdc1859388d1c8b2283b4001188687 Mon Sep 17 00:00:00 2001 From: Antynea Date: Fri, 11 Sep 2015 22:46:26 +0200 Subject: [PATCH 01/12] new ideas --- 41_snapshots-btrfs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 4e5e6d4..f2c7f39 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -30,7 +30,9 @@ # To do: # # # # # * verify compatibility with manjaro and snapper (but I don't use them, so it will take some time) # -# # +# * afficher le chemin complet des snapshots ou simplement le nom # +# * refaire le menu des snapshots, mettre en titre le nom du snap et en entrée seulement les kernels,init,microcode # +# * Peut-être afficher la date et l'heure en premier dans le menu de boot (grub-menu) # # # ######################################################################################################################################################### @@ -54,6 +56,8 @@ choise_of_method=${GRUB_BTRFS_SUBMENUNAME:-"1"} submenuname=${GRUB_BTRFS_SUBMENUNAME:-"ArchLinux Snapshots"} ## Prefix entry prefixentry=${GRUB_BTRFS_PREFIXENTRY:-"Snapshot:"} +## Show path snapshot +path_snapshot=${GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT:-"true"} ## Kernel(s) name(s) nkernel=("${GRUB_BTRFS_NKERNEL[@]}") ## Initramfs name(s) From 2cf01a874f91b92a5b356bf77597daf08f9a3b5e Mon Sep 17 00:00:00 2001 From: Antynea Date: Fri, 18 Sep 2015 14:52:17 +0200 Subject: [PATCH 02/12] in progress add custom title --- 41_snapshots-btrfs | 58 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index f2c7f39..c0840ee 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash # # ######################################################################################################################################################### @@ -17,6 +17,7 @@ # # # * GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" (Name menu appearing in grub.) # # * GRUB_BTRFS_PREFIXENTRY="Snapshot:" (Add a name ahead your snapshots entries.) # +# * GRUB_BTRFS_TITLE_FORMAT="p;d;n" (Custom title, shows/hides p"prefix";d"date";n"name" in grub-grubmenu) # # * GRUB_BTRFS_NKERNEL=("vmlinuz-linux") (Use only if you have custom kernel name or auto-detect failed.) # # * GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") (Use only if you have custom initramfs name or auto-detect failed.) # # * GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img") (Use only if you have custom intel-ucode or auto-detect failed.) # @@ -29,10 +30,9 @@ # # # To do: # # # # -# * verify compatibility with manjaro and snapper (but I don't use them, so it will take some time) # # * afficher le chemin complet des snapshots ou simplement le nom # -# * refaire le menu des snapshots, mettre en titre le nom du snap et en entrée seulement les kernels,init,microcode # -# * Peut-être afficher la date et l'heure en premier dans le menu de boot (grub-menu) # +# * (in progress) refaire le menu des snapshots, mettre en titre le nom du snap et en entrée seulement les kernels,init,microcode # +# * (in progress) Peut-être afficher la date et l'heure en premier dans le menu de boot (grub-menu) # # # ######################################################################################################################################################### @@ -57,7 +57,9 @@ submenuname=${GRUB_BTRFS_SUBMENUNAME:-"ArchLinux Snapshots"} ## Prefix entry prefixentry=${GRUB_BTRFS_PREFIXENTRY:-"Snapshot:"} ## Show path snapshot -path_snapshot=${GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT:-"true"} +#path_snapshot=${GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT:-"true"} +## Title format +title_format=${GRUB_BTRFS_TITLE_FORMAT:-"p;d;n"} ## Kernel(s) name(s) nkernel=("${GRUB_BTRFS_NKERNEL[@]}") ## Initramfs name(s) @@ -106,12 +108,14 @@ boot_dir() snapshots_entry() { ## \" required for snap,kernels,init,microcode with space in their name - echo " submenu '${1} ${2} ${3}' {" + echo " submenu '"${title_menu[*]}"' { + submenu '---> "${title_menu[*]}" <---' { echo } + " for k in "${name_kernel[@]}"; do for i in "${name_initramfs[@]}"; do for u in "${name_microcode[@]}"; do echo "\ - menuentry '${2} with "${k}" & "${i}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{ + menuentry '"${k}" & "${i}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{ $(save_default_entry) if [ x\$feature_all_video_module = xy ]; then insmod all_video @@ -123,15 +127,16 @@ snapshots_entry() else search --no-floppy --fs-uuid --set=root ${boot_uuid} fi - echo 'Loading Snapshot: "${2}" "${3}"' + echo 'Loading Snapshot: "${snap_date_time}" "${snap_dir_name}"' 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}" ...'" + linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters}" if [ -f "$(boot_dir)"/"${u}" ] ; then echo "\ + echo 'Loading Microcode & Initramfs: "${u}" "${i}" ...' initrd \"${boot_dir_real_path}/"${u}"\" \"/"${snap_dir_name}"/boot/"${i}"\"" else echo "\ + echo 'Loading Initramfs: "${i}" ...' initrd \"${boot_dir_real_path}/"${i}"\"" fi echo " }" @@ -206,6 +211,30 @@ detect_microcode() fi } +## Title format in grub-menu +title_format() +{ + if [[ "${title_format}" == "p;d;n" ]]; then + title_menu=("${prefixentry}" "${snap_date_time}" "${snap_dir_name}") + elif [[ "${title_format}" == "p;n;d" ]]; then + title_menu=("${prefixentry}" "${snap_dir_name}" "${snap_date_time}") + elif [[ "${title_format}" == "p;d" ]]; then + title_menu=("${prefixentry}" "${snap_date_time}") + elif [[ "${title_format}" == "p;n" ]]; then + title_menu=("${prefixentry}" "${snap_dir_name}") + elif [[ "${title_format}" == "d;n" ]]; then + title_menu=("${snap_date_time}" "${snap_dir_name}") + elif [[ "${title_format}" == "n;d" ]]; then + title_menu=("${snap_dir_name}" "${snap_date_time}") + elif [[ "${title_format}" == "p" ]]; then + title_menu=("${prefixentry}") + elif [[ "${title_format}" == "d" ]]; then + title_menu=("${snap_date_time}") + elif [[ "${title_format}" == "n" ]]; then + title_menu=("${snap_dir_name}") + fi +} + ## List of kernels, initramfs and microcode in snapshots list_kernels_initramfs() { @@ -216,7 +245,7 @@ list_kernels_initramfs() snap_dir_name=${item[@]:2:${#item[@]}} [[ ! -d "$gbgmp/$snap_dir_name/boot" ]] && continue; snap_date_time=${item[@]:0:2} - gettext_printf $"# Found Snapshot: %s\n" "$snap_dir_name $snap_date_time" >&2 ; + gettext_printf $"# Found Snapshot: %s\n" "${snap_date_time} ${snap_dir_name}" >&2 ; unset list_kernel detect_kernel name_kernel=("${list_kernel[@]##*"/"}") @@ -230,8 +259,11 @@ list_kernels_initramfs() name_microcode=("${list_ucode[@]##*"/"}") # echo "ucode = ${name_microcode[*]}" 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}" + ## Create menu entries + # title menu custom + title_format + # echo "${title_menu[*]}" + snapshots_entry done IFS=$oldIFS } From 14cbf60c5aa5ea737f597a014e72c94ee2b5e47f Mon Sep 17 00:00:00 2001 From: Antynea Date: Sat, 19 Sep 2015 04:31:17 +0200 Subject: [PATCH 03/12] in progress : custom title menu --- 41_snapshots-btrfs | 126 ++++++++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 54 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index c0840ee..2df758d 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -1,40 +1,46 @@ #! /usr/bin/env bash # # -######################################################################################################################################################### -# Written by: Antynea # -# # -# Purpose: Include btrfs snapshots at boot options. # -# # -# What this script does: # -# - Automatically List snapshots existing on root partition (btrfs). # -# - Automatically Detect if "/boot" is in separate partition. # -# - Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots. (For custon name, see below.) # -# - Automatically Create corresponding "menuentry" in grub.cfg , which ensures a very easy rollback. # -# # -# How to use it: # -# - Add this lines to /etc/default/grub: # -# # -# * GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" (Name menu appearing in grub.) # -# * GRUB_BTRFS_PREFIXENTRY="Snapshot:" (Add a name ahead your snapshots entries.) # -# * GRUB_BTRFS_TITLE_FORMAT="p;d;n" (Custom title, shows/hides p"prefix";d"date";n"name" in grub-grubmenu) # -# * GRUB_BTRFS_NKERNEL=("vmlinuz-linux") (Use only if you have custom kernel name or auto-detect failed.) # -# * GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") (Use only if you have custom initramfs name or auto-detect failed.) # -# * GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img") (Use only if you have custom intel-ucode or auto-detect failed.) # -# # -# - Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg) # -# # -# - grub-btrfs automatically generates snapshots entries. # -# - You will see it appear different entries (e.g : Snapshot: my snapshot name overkill [2014-02-12 11:24:37]) # -# # -# # -# To do: # -# # # -# * afficher le chemin complet des snapshots ou simplement le nom # -# * (in progress) refaire le menu des snapshots, mettre en titre le nom du snap et en entrée seulement les kernels,init,microcode # -# * (in progress) Peut-être afficher la date et l'heure en premier dans le menu de boot (grub-menu) # -# # -######################################################################################################################################################### +################################################################################################################################################# +# Written by: Antynea # +# # +# Purpose: Include btrfs snapshots at boot options. # +# # +# What this script does: # +# - Automatically List snapshots existing on root partition (btrfs). # +# - Automatically Detect if "/boot" is in separate partition. # +# - Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots. (For custon name, see below.) # +# - Automatically Create corresponding "menuentry" in grub.cfg , which ensures a very easy rollback. # +# # +# How to use it: # +# - Add this lines to /etc/default/grub: # +# # +# * GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" # + (Name menu appearing in grub.) # +# * GRUB_BTRFS_PREFIXENTRY="Snapshot:" # + (Add a name ahead your snapshots entries.) # +# * GRUB_BTRFS_TITLE_FORMAT="p;d;n" # + (Custom title, shows/hides p"prefix";d"date";n"name" in grub-grubmenu) # +# * GRUB_BTRFS_NKERNEL=("vmlinuz-linux") # + (Use only if you have custom kernel name or auto-detect failed.) # +# * GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") # + (Use only if you have custom initramfs name or auto-detect failed.) # +# * GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img") # + (Use only if you have custom intel-ucode or auto-detect failed.) # +# # +# - Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg) # +# # +# - grub-btrfs automatically generates snapshots entries. # +# - You will see it appear different entries (e.g : Snapshot: my snapshot name overkill [2014-02-12 11:24:37]) # +# # +# # +# To do: # +# # # +# * afficher le chemin complet des snapshots ou simplement le nom # +# * (in progress) refaire le menu des snapshots, mettre en titre le nom du snap et en entrée seulement les kernels,init,microcode # +# * (in progress) Peut-être afficher la date et l'heure en premier dans le menu de boot (grub-menu) # +# # +################################################################################################################################################# set -e @@ -59,7 +65,7 @@ prefixentry=${GRUB_BTRFS_PREFIXENTRY:-"Snapshot:"} ## Show path snapshot #path_snapshot=${GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT:-"true"} ## Title format -title_format=${GRUB_BTRFS_TITLE_FORMAT:-"p;d;n"} +title_format=${GRUB_BTRFS_TITLE_FORMAT:-"p/d/n"} ## Kernel(s) name(s) nkernel=("${GRUB_BTRFS_NKERNEL[@]}") ## Initramfs name(s) @@ -214,25 +220,37 @@ detect_microcode() ## Title format in grub-menu title_format() { - if [[ "${title_format}" == "p;d;n" ]]; then - title_menu=("${prefixentry}" "${snap_date_time}" "${snap_dir_name}") - elif [[ "${title_format}" == "p;n;d" ]]; then - title_menu=("${prefixentry}" "${snap_dir_name}" "${snap_date_time}") - elif [[ "${title_format}" == "p;d" ]]; then - title_menu=("${prefixentry}" "${snap_date_time}") - elif [[ "${title_format}" == "p;n" ]]; then - title_menu=("${prefixentry}" "${snap_dir_name}") - elif [[ "${title_format}" == "d;n" ]]; then - title_menu=("${snap_date_time}" "${snap_dir_name}") - elif [[ "${title_format}" == "n;d" ]]; then - title_menu=("${snap_dir_name}" "${snap_date_time}") - elif [[ "${title_format}" == "p" ]]; then - title_menu=("${prefixentry}") - elif [[ "${title_format}" == "d" ]]; then - title_menu=("${snap_date_time}") - elif [[ "${title_format}" == "n" ]]; then - title_menu=("${snap_dir_name}") - fi + # if [[ "${title_format}" == "p;d;n" ]]; then + # title_menu=("${prefixentry}" "${snap_date_time}" "${snap_dir_name}") + # elif [[ "${title_format}" == "p;n;d" ]]; then + # title_menu=("${prefixentry}" "${snap_dir_name}" "${snap_date_time}") + # elif [[ "${title_format}" == "p;d" ]]; then + # title_menu=("${prefixentry}" "${snap_date_time}") + # elif [[ "${title_format}" == "p;n" ]]; then + # title_menu=("${prefixentry}" "${snap_dir_name}") + # elif [[ "${title_format}" == "d;n" ]]; then + # title_menu=("${snap_date_time}" "${snap_dir_name}") + # elif [[ "${title_format}" == "n;d" ]]; then + # title_menu=("${snap_dir_name}" "${snap_date_time}") + # elif [[ "${title_format}" == "p" ]]; then + # title_menu=("${prefixentry}") + # elif [[ "${title_format}" == "d" ]]; then + # title_menu=("${snap_date_time}") + # elif [[ "${title_format}" == "n" ]]; then + # title_menu=("${snap_dir_name}") + # fi + + case "${title_format}" in + p/d/n) title_menu=("${prefixentry}" "${snap_date_time}" "${snap_dir_name}");; + p/n/d) title_menu=("${prefixentry}" "${snap_dir_name}" "${snap_date_time}");; + p/d) title_menu=("${prefixentry}" "${snap_date_time}");; + p/n) title_menu=("${prefixentry}" "${snap_dir_name}");; + d/n) title_menu=("${snap_date_time}" "${snap_dir_name}");; + n/d) title_menu=("${snap_dir_name}" "${snap_date_time}");; + p) title_menu=("${prefixentry}");; + d) title_menu=("${snap_date_time}");; + n) title_menu=("${snap_dir_name}") + esac } ## List of kernels, initramfs and microcode in snapshots From 25e2c1682818122fa410f414e7fde64c25a82149 Mon Sep 17 00:00:00 2001 From: Antynea Date: Sat, 19 Sep 2015 04:48:45 +0200 Subject: [PATCH 04/12] in progress custom title menu --- 41_snapshots-btrfs | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 2df758d..591b83b 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -16,17 +16,17 @@ # - Add this lines to /etc/default/grub: # # # # * GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" # - (Name menu appearing in grub.) # +# (Name menu appearing in grub.) # # * GRUB_BTRFS_PREFIXENTRY="Snapshot:" # - (Add a name ahead your snapshots entries.) # -# * GRUB_BTRFS_TITLE_FORMAT="p;d;n" # - (Custom title, shows/hides p"prefix";d"date";n"name" in grub-grubmenu) # +# (Add a name ahead your snapshots entries.) # +# * GRUB_BTRFS_TITLE_FORMAT="p/d/n" # +# (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/") # # * GRUB_BTRFS_NKERNEL=("vmlinuz-linux") # - (Use only if you have custom kernel name or auto-detect failed.) # +# (Use only if you have custom kernel name or auto-detect failed.) # # * GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") # - (Use only if you have custom initramfs name or auto-detect failed.) # +# (Use only if you have custom initramfs name or auto-detect failed.) # # * GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img") # - (Use only if you have custom intel-ucode or auto-detect failed.) # +# (Use only if you have custom intel-ucode or auto-detect failed.) # # # # - Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg) # # # @@ -220,26 +220,6 @@ detect_microcode() ## Title format in grub-menu title_format() { - # if [[ "${title_format}" == "p;d;n" ]]; then - # title_menu=("${prefixentry}" "${snap_date_time}" "${snap_dir_name}") - # elif [[ "${title_format}" == "p;n;d" ]]; then - # title_menu=("${prefixentry}" "${snap_dir_name}" "${snap_date_time}") - # elif [[ "${title_format}" == "p;d" ]]; then - # title_menu=("${prefixentry}" "${snap_date_time}") - # elif [[ "${title_format}" == "p;n" ]]; then - # title_menu=("${prefixentry}" "${snap_dir_name}") - # elif [[ "${title_format}" == "d;n" ]]; then - # title_menu=("${snap_date_time}" "${snap_dir_name}") - # elif [[ "${title_format}" == "n;d" ]]; then - # title_menu=("${snap_dir_name}" "${snap_date_time}") - # elif [[ "${title_format}" == "p" ]]; then - # title_menu=("${prefixentry}") - # elif [[ "${title_format}" == "d" ]]; then - # title_menu=("${snap_date_time}") - # elif [[ "${title_format}" == "n" ]]; then - # title_menu=("${snap_dir_name}") - # fi - case "${title_format}" in p/d/n) title_menu=("${prefixentry}" "${snap_date_time}" "${snap_dir_name}");; p/n/d) title_menu=("${prefixentry}" "${snap_dir_name}" "${snap_date_time}");; From 9d3aa6d8a33cb21c7487de8525e02faed87c88f5 Mon Sep 17 00:00:00 2001 From: Antynea Date: Wed, 23 Sep 2015 02:14:46 +0200 Subject: [PATCH 05/12] Update : translation update New option in /etc/default/grub * GRUB_BTRFS_TITLE_FORMAT="p/d/n" (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available) --- 41_snapshots-btrfs | 32 +++++++++++++++--------------- localisation/fr/grub-btrfs-git.mo | Bin 104 -> 275 bytes 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 591b83b..56a58da 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -20,7 +20,7 @@ # * GRUB_BTRFS_PREFIXENTRY="Snapshot:" # # (Add a name ahead your snapshots entries.) # # * GRUB_BTRFS_TITLE_FORMAT="p/d/n" # -# (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/") # +# (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available) # # * GRUB_BTRFS_NKERNEL=("vmlinuz-linux") # # (Use only if you have custom kernel name or auto-detect failed.) # # * GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") # @@ -37,8 +37,6 @@ # To do: # # # # # * afficher le chemin complet des snapshots ou simplement le nom # -# * (in progress) refaire le menu des snapshots, mettre en titre le nom du snap et en entrée seulement les kernels,init,microcode # -# * (in progress) Peut-être afficher la date et l'heure en premier dans le menu de boot (grub-menu) # # # ################################################################################################################################################# @@ -116,11 +114,11 @@ snapshots_entry() ## \" required for snap,kernels,init,microcode with space in their name echo " submenu '"${title_menu[*]}"' { submenu '---> "${title_menu[*]}" <---' { echo } - " - for k in "${name_kernel[@]}"; do - for i in "${name_initramfs[@]}"; do - for u in "${name_microcode[@]}"; do - echo "\ + " + for k in "${name_kernel[@]}"; do + for i in "${name_initramfs[@]}"; do + for u in "${name_microcode[@]}"; do + echo "\ menuentry '"${k}" & "${i}"' ${CLASS} "\$menuentry_id_option" 'gnulinux-snapshots-$boot_uuid'{ $(save_default_entry) if [ x\$feature_all_video_module = xy ]; then @@ -135,20 +133,21 @@ snapshots_entry() fi echo 'Loading Snapshot: "${snap_date_time}" "${snap_dir_name}"' echo 'Loading Kernel: "${k}" ...' - linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters}" - if [ -f "$(boot_dir)"/"${u}" ] ; then - echo "\ + linux \"${boot_dir_real_path}/"${k}"\" root=UUID=${root_uuid} rw rootflags=subvol=\""${snap_dir_name}"\" ${kernel_parameters}\ + " + if [ -f "$(boot_dir)"/"${u}" ] ; then + echo "\ echo 'Loading Microcode & Initramfs: "${u}" "${i}" ...' initrd \"${boot_dir_real_path}/"${u}"\" \"/"${snap_dir_name}"/boot/"${i}"\"" - else - echo "\ + else + echo "\ echo 'Loading Initramfs: "${i}" ...' initrd \"${boot_dir_real_path}/"${i}"\"" - fi + fi echo " }" - done done done + done echo " }" } @@ -229,7 +228,8 @@ title_format() n/d) title_menu=("${snap_dir_name}" "${snap_date_time}");; p) title_menu=("${prefixentry}");; d) title_menu=("${snap_date_time}");; - n) title_menu=("${snap_dir_name}") + n) title_menu=("${snap_dir_name}");; + *) gettext_printf $"# Warning: GRUB_BTRFS_TITLE_FORMAT=${title_format}, syntax error \n" >&2 esac } diff --git a/localisation/fr/grub-btrfs-git.mo b/localisation/fr/grub-btrfs-git.mo index 8ed56e56597e7b18c2a036cb75f96ad74525ec0b..f713050c6580cdc20d05b93bf792405192657082 100644 GIT binary patch literal 275 zcmca7#4?ou2$+Ca28eZlm=%a^fLIKO1Ay2Wh|_^s0*F@wu^$j00b-CI5MYE*U{YDZ zEx$A`MIksZv7k63zr;#GwKyh^L0KU@u_!MyFWpMPJt)*E-YF!=EjT{JGsMR=-pxPA z*D=IarMe`uBqudKEx#x?v7}Zyu fm1Gtdr{<>S0j(t33ZU7kr9}!UsZh&OLG}Ou16xP@ literal 104 zcmca7#4?ou2pEA_28dOFm>Gz5fLIKOEr3`8i2Z>W20&_+72NVm^HLOo^AZb+GxAHU X6jY02@_@oH0fmyH{L-?+E1?nqefJYK From 4081cbd27a38c3c52f50e2c44477688f41257ac1 Mon Sep 17 00:00:00 2001 From: Antynea Date: Wed, 23 Sep 2015 02:29:01 +0200 Subject: [PATCH 06/12] update how to use it & to do: add : * GRUB_BTRFS_TITLE_FORMAT="p/d/n" (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available) * Show full path or only name of snapshots in grub-menu --- README.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 308d4bc..d7b2389 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,20 @@ Simple rollback using snapshots you made previously. Add this lines to /etc/default/grub: -* GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" (Name menu appearing in grub.) -* GRUB_BTRFS_PREFIXENTRY="Snapshot:" (Add a name ahead your snapshots entries.) -* GRUB_BTRFS_NKERNEL=("vmlinuz-linux") (Use only if you have custom kernel name or auto-detect failed.) -* GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") (Use only if you have custom initramfs name or auto-detect failed.) -* GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img") (Use only if you have custom intel-ucode or auto-detect failed.) - +* GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" + (Name menu appearing in grub.) +* GRUB_BTRFS_PREFIXENTRY="Snapshot:" + (Add a name ahead your snapshots entries.) +* GRUB_BTRFS_TITLE_FORMAT="p/d/n" + (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available) +* GRUB_BTRFS_NKERNEL=("vmlinuz-linux") + (Use only if you have custom kernel name or auto-detect failed.) +* GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") + (Use only if you have custom initramfs name or auto-detect failed.) +* GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img") + (Use only if you have custom intel-ucode or auto-detect failed.) + + Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg ) grub-btrfs automatically generates snapshots entries. @@ -37,7 +45,7 @@ You will see it appear differents entries (e.g : Snapshot: my snapshot name over #### TO DO -* verify compatibility with manjaro and snapper (but I don't use them, so it will take some time) +* Show full path or only name of snapshots in grub-menu From 58b8f5d3ece94e02a3a4e094d8df8727a862e34a Mon Sep 17 00:00:00 2001 From: Antynea Date: Wed, 23 Sep 2015 02:32:10 +0200 Subject: [PATCH 07/12] Update README.md --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d7b2389..5d85e56 100644 --- a/README.md +++ b/README.md @@ -23,16 +23,27 @@ Simple rollback using snapshots you made previously. Add this lines to /etc/default/grub: * GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" + (Name menu appearing in grub.) + * GRUB_BTRFS_PREFIXENTRY="Snapshot:" + (Add a name ahead your snapshots entries.) + * GRUB_BTRFS_TITLE_FORMAT="p/d/n" - (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available) + + (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available) + * GRUB_BTRFS_NKERNEL=("vmlinuz-linux") + (Use only if you have custom kernel name or auto-detect failed.) + * GRUB_BTRFS_NINIT=("initramfs-linux.img" "initramfs-linux-fallback.img") + (Use only if you have custom initramfs name or auto-detect failed.) + * GRUB_BTRFS_INTEL_UCODE=("intel-ucode.img") + (Use only if you have custom intel-ucode or auto-detect failed.) From 2df311179e0bd83066fccb64b71ae99e2620d8eb Mon Sep 17 00:00:00 2001 From: Antynea Date: Wed, 23 Sep 2015 02:33:44 +0200 Subject: [PATCH 08/12] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d85e56..a823e22 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,8 @@ Add this lines to /etc/default/grub: (Use only if you have custom intel-ucode or auto-detect failed.) - + + Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg ) grub-btrfs automatically generates snapshots entries. From 63d653746be714ee4f0249d00a514d6b75c6ad92 Mon Sep 17 00:00:00 2001 From: Antynea Date: Wed, 23 Sep 2015 02:36:04 +0200 Subject: [PATCH 09/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a823e22..e3b2bc1 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg ) grub-btrfs automatically generates snapshots entries. -You will see it appear differents entries (e.g : Snapshot: my snapshot name overkill [2014-02-12 11:24:37]) +You will see it appear differents entries (e.g : Snapshot: [2014-02-12 11:24:37] my snapshot name overkill ) #### TO DO From b51121064688b67b54f3bf6e25dfdc080d1c6b39 Mon Sep 17 00:00:00 2001 From: Antynea Date: Wed, 23 Sep 2015 02:39:26 +0200 Subject: [PATCH 10/12] Update README.md --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e3b2bc1..b99c9d7 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,13 @@ grub-btrfs, Include btrfs snapshots at boot options. (grub menu) Simple rollback using snapshots you made previously. -- Automatically List snapshots existing on root partition (btrfs). -- Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots. (For custon name, see below.) -- Automatically Create corresponding menuentry in grub.cfg , which ensures a very easy rollback. +* Automatically List snapshots existing on root partition (btrfs). + +* Automatically Detect if "/boot" is in separate partition. + +* Automatically Detect kernel, initramfs and intel microcode in "/boot" directory on snapshots. (For custon name, see below.) + +* Automatically Create corresponding "menuentry" in grub.cfg , which ensures a very easy rollback. #### How to use it: From 39b2d09015854a01bc93050118b46615d19151bb Mon Sep 17 00:00:00 2001 From: Antynea Date: Thu, 24 Sep 2015 08:41:23 +0200 Subject: [PATCH 11/12] Add Show full path or only name of snapshots in grub-menu --- 41_snapshots-btrfs | 24 +++++++++++++++++++----- README.md | 6 +++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 56a58da..693604e 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -18,7 +18,9 @@ # * GRUB_BTRFS_SUBMENUNAME="ArchLinux Snapshots" # # (Name menu appearing in grub.) # # * GRUB_BTRFS_PREFIXENTRY="Snapshot:" # -# (Add a name ahead your snapshots entries.) # +# (Add a name ahead your snapshots entries.) # +# * GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT="true" # +# (Show full path snapshot or only name) # # * GRUB_BTRFS_TITLE_FORMAT="p/d/n" # # (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available) # # * GRUB_BTRFS_NKERNEL=("vmlinuz-linux") # @@ -36,7 +38,7 @@ # # # To do: # # # # -# * afficher le chemin complet des snapshots ou simplement le nom # +# * Display name of microcode in menuentry when available # # # ################################################################################################################################################# @@ -60,8 +62,8 @@ choise_of_method=${GRUB_BTRFS_SUBMENUNAME:-"1"} submenuname=${GRUB_BTRFS_SUBMENUNAME:-"ArchLinux Snapshots"} ## Prefix entry prefixentry=${GRUB_BTRFS_PREFIXENTRY:-"Snapshot:"} -## Show path snapshot -#path_snapshot=${GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT:-"true"} +## Show full path snapshot or only name +path_snapshot=${GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT:-"true"} ## Title format title_format=${GRUB_BTRFS_TITLE_FORMAT:-"p/d/n"} ## Kernel(s) name(s) @@ -216,11 +218,21 @@ detect_microcode() fi } +## Show full path snapshot or only name +path_snapshot() +{ + case "${path_snapshot}" in + true) name_snapshot=("${snap_dir_name}");; + *) name_snapshot=("${snap_dir_name#*"/"}") + esac +} + + ## Title format in grub-menu title_format() { case "${title_format}" in - p/d/n) title_menu=("${prefixentry}" "${snap_date_time}" "${snap_dir_name}");; + p/d/n) title_menu=("${prefixentry}" "${snap_date_time}" "${name_snapshot}");; p/n/d) title_menu=("${prefixentry}" "${snap_dir_name}" "${snap_date_time}");; p/d) title_menu=("${prefixentry}" "${snap_date_time}");; p/n) title_menu=("${prefixentry}" "${snap_dir_name}");; @@ -258,6 +270,8 @@ list_kernels_initramfs() # echo "ucode = ${name_microcode[*]}" boot_dir_real_path="$(make_system_path_relative_to_its_root "$(boot_dir)")" ## Create menu entries + # name snpashot + path_snapshot # title menu custom title_format # echo "${title_menu[*]}" diff --git a/README.md b/README.md index b99c9d7..cdc0dfa 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ Add this lines to /etc/default/grub: (Add a name ahead your snapshots entries.) +* GRUB_BTRFS_DISPLAY_PATH_SNAPSHOT="true" + + (Show full path snapshot or only name) + * GRUB_BTRFS_TITLE_FORMAT="p/d/n" (Custom title, shows/hides p"prefix" d"date" n"name" in grub-menu, separator "/", custom order available) @@ -61,7 +65,7 @@ You will see it appear differents entries (e.g : Snapshot: [2014-02-12 11:24:37] #### TO DO -* Show full path or only name of snapshots in grub-menu +* Display name of microcode in menuentry when available From 3db73de47921c1f0f4f3a686232d86f6b9afc3a7 Mon Sep 17 00:00:00 2001 From: Antynea Date: Fri, 25 Sep 2015 10:24:20 +0200 Subject: [PATCH 12/12] fixme : choise of method --- 41_snapshots-btrfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/41_snapshots-btrfs b/41_snapshots-btrfs index 693604e..56f5fbe 100644 --- a/41_snapshots-btrfs +++ b/41_snapshots-btrfs @@ -33,7 +33,7 @@ # - Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg) # # # # - grub-btrfs automatically generates snapshots entries. # -# - You will see it appear different entries (e.g : Snapshot: my snapshot name overkill [2014-02-12 11:24:37]) # +# - You will see it appear different entries (e.g : Snapshot: [2014-02-12 11:24:37] my snapshot name overkill) # # # # # # To do: # @@ -57,7 +57,7 @@ sysconfdir="/etc" ### Variables in /etc/default/grub ### ###################################### ## Choice of method -choise_of_method=${GRUB_BTRFS_SUBMENUNAME:-"1"} +choise_of_method=${GRUB_BTRFS_METHOD:-"1"} ## Submenu name submenuname=${GRUB_BTRFS_SUBMENUNAME:-"ArchLinux Snapshots"} ## Prefix entry