Skip to content

Commit

Permalink
Add Show full path or only name of snapshots in grub-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Antynea committed Sep 24, 2015
1 parent b511210 commit 39b2d09
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
24 changes: 19 additions & 5 deletions 41_snapshots-btrfs
Original file line number Diff line number Diff line change
Expand Up @@ -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") #
Expand All @@ -36,7 +38,7 @@
# #
# To do: #
# # #
# * afficher le chemin complet des snapshots ou simplement le nom #
# * Display name of microcode in menuentry when available #
# #
#################################################################################################################################################

Expand All @@ -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)
Expand Down Expand Up @@ -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}");;
Expand Down Expand Up @@ -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[*]}"
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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



Expand Down

0 comments on commit 39b2d09

Please sign in to comment.