mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-10 00:05:32 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ae56dbaf6 | ||
|
|
f820de4759 | ||
|
|
59164367e7 | ||
|
|
f256338074 |
@@ -72,6 +72,14 @@ nkernel=("${GRUB_BTRFS_NKERNEL[@]}")
|
|||||||
ninit=("${GRUB_BTRFS_NINIT[@]}")
|
ninit=("${GRUB_BTRFS_NINIT[@]}")
|
||||||
## Microcode(s) name(s)
|
## Microcode(s) name(s)
|
||||||
microcode=("${GRUB_BTRFS_INTEL_UCODE[@]}")
|
microcode=("${GRUB_BTRFS_INTEL_UCODE[@]}")
|
||||||
|
## Limit to show in menu
|
||||||
|
limit=("${GRUB_BTRFS_LIMIT[@]:-100}")
|
||||||
|
## How to sort
|
||||||
|
subvolsort=${GRUB_BTRFS_SUBVOLUME_SORT:-"descending"}
|
||||||
|
case "${subvolsort}" in
|
||||||
|
ascending) btrfssubvolsort=("--sort=+rootid");;
|
||||||
|
*) btrfssubvolsort=("--sort=-rootid")
|
||||||
|
esac
|
||||||
|
|
||||||
########################
|
########################
|
||||||
### variables script ###
|
### variables script ###
|
||||||
@@ -156,7 +164,7 @@ snapshots_entry()
|
|||||||
## List of snapshots on filesystem
|
## List of snapshots on filesystem
|
||||||
snapshot_list()
|
snapshot_list()
|
||||||
{
|
{
|
||||||
for snap in $(btrfs subvolume list -sa /); do
|
for snap in $(btrfs subvolume list -sa "${btrfssubvolsort}" /); do
|
||||||
IFS=$oldIFS
|
IFS=$oldIFS
|
||||||
snap=($snap)
|
snap=($snap)
|
||||||
local snap_path_name=${snap[@]:13:${#snap[@]}}
|
local snap_path_name=${snap[@]:13:${#snap[@]}}
|
||||||
@@ -249,6 +257,7 @@ title_format()
|
|||||||
list_kernels_initramfs()
|
list_kernels_initramfs()
|
||||||
{
|
{
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
c=0
|
||||||
for item in $(snapshot_list); do
|
for item in $(snapshot_list); do
|
||||||
IFS=$oldIFS
|
IFS=$oldIFS
|
||||||
item=($item)
|
item=($item)
|
||||||
@@ -276,6 +285,10 @@ list_kernels_initramfs()
|
|||||||
title_format
|
title_format
|
||||||
# echo "${title_menu[*]}"
|
# echo "${title_menu[*]}"
|
||||||
snapshots_entry
|
snapshots_entry
|
||||||
|
c=$((1+$c))
|
||||||
|
if [[ $c -gt $limit ]]; then
|
||||||
|
break;
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
IFS=$oldIFS
|
IFS=$oldIFS
|
||||||
}
|
}
|
||||||
@@ -292,4 +305,4 @@ if [ ${choise_of_method} = "1" ] ; then
|
|||||||
umount $gbgmp
|
umount $gbgmp
|
||||||
gettext_printf "###### - Grub-btrfs: Auto-detect - ######\n" >&2 ;
|
gettext_printf "###### - Grub-btrfs: Auto-detect - ######\n" >&2 ;
|
||||||
fi
|
fi
|
||||||
### End choice of method ###
|
### End choice of method ###
|
||||||
|
|||||||
@@ -54,7 +54,15 @@ Add this lines to /etc/default/grub:
|
|||||||
|
|
||||||
(Use only if you have custom intel-ucode or auto-detect failed.)
|
(Use only if you have custom intel-ucode or auto-detect failed.)
|
||||||
|
|
||||||
|
* GRUB_BTRFS_LIMIT=("100")
|
||||||
|
|
||||||
|
(Limit the number of snapshots populated in the GRUB menu.)
|
||||||
|
|
||||||
|
* GRUB_BTRFS_SUBVOLUME_SORT=("descending")
|
||||||
|
|
||||||
|
(Sort the found subvolumes by newest first ("descending") or oldest first
|
||||||
|
("ascending"). If "ascending" is chosen then the $GRUB_BTRFS_LIMIT oldest
|
||||||
|
subvolumes will populate the menu.)
|
||||||
|
|
||||||
Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg )
|
Generate grub.cfg (on Archlinux use grub-mkconfig -o /boot/grub/grub.cfg )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user