Compare commits

..

14 Commits
v1.7 ... v1.8

Author SHA1 Message Date
Antynea
6ae56dbaf6 Merge pull request #16 from wesbarnett/master
Add GRUB_BTRFS_LIMIT 
add GRUB_BTRFS_SUBVOLUME_SORT
2016-03-19 16:35:54 +01:00
James Barnett
f820de4759 add sorting options 2016-03-19 08:19:10 -05:00
James Barnett
59164367e7 cleanup 2016-03-19 08:11:47 -05:00
James Barnett
f256338074 Add GRUB_BTRFS_LIMIT
Allow user to limit the number of snapshots listed in GRUB. This also reverses
the order of the snapshots such that the more recent ones come first. That is,
if a user specifies GRUB_BTRFS_LIMIT=10, then only the 10 most recent snapshots
will be shown. The default limit is 100, which seems very large. The more
snapshots in the GRUB menu, the longer the system takes to boot.
2016-03-18 16:46:11 -05:00
Antynea
52ab9dbe95 Merge pull request #14 from Antynea/v1.xx
fix: incorrect detection "$boot_dir_real_path" for initramfs
2016-02-15 03:44:10 +01:00
Antynea
28e9524ca5 fix: incorrect detection "$boot_dir_real_path" for initramfs 2016-02-08 00:01:42 +01:00
Antynea
8fffc13c2f Merge pull request #12 from Antynea/v1.xx
enhanced description
2016-01-15 18:31:18 +01:00
Antynea
a4db6a8870 enhanced description 2016-01-15 18:29:52 +01:00
Antynea
4388c334a3 Merge branch 'v1.xx' 2015-09-25 10:33:04 +02:00
Antynea
a2acaefa9c Merge branch 'master' into v1.xx 2015-09-25 10:32:33 +02:00
Antynea
252a6372dd Merge branch 'v1.xx' 2015-08-31 04:57:11 +02:00
Antynea
1c6c8c6051 Merge branch 'v1.xx'
Fix: redundancy parameter
2015-08-31 04:29:41 +02:00
Antynea
650ac69552 Merge branch 'v1.xx' 2015-08-30 16:18:45 +02:00
Antynea
615cbe9f3a Merge branch 'v1.xx' 2015-08-30 03:43:08 +02:00
2 changed files with 25 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
#################################################################################################################################################
# Written by: Antynea #
# #
# Purpose: Include btrfs snapshots at boot options. #
# Purpose: Include btrfs snapshots at boot options (grub-menu). #
# #
# What this script does: #
# - Automatically List snapshots existing on root partition (btrfs). #
@@ -72,6 +72,14 @@ nkernel=("${GRUB_BTRFS_NKERNEL[@]}")
ninit=("${GRUB_BTRFS_NINIT[@]}")
## Microcode(s) name(s)
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 ###
@@ -140,7 +148,7 @@ snapshots_entry()
if [ -f "$(boot_dir)"/"${u}" ] ; then
echo "\
echo 'Loading Microcode & Initramfs: "${u}" "${i}" ...'
initrd \"${boot_dir_real_path}/"${u}"\" \"/"${snap_dir_name}"/boot/"${i}"\""
initrd \"${boot_dir_real_path}/"${u}"\" \"${boot_dir_real_path}/"${i}"\""
else
echo "\
echo 'Loading Initramfs: "${i}" ...'
@@ -156,7 +164,7 @@ snapshots_entry()
## List of snapshots on filesystem
snapshot_list()
{
for snap in $(btrfs subvolume list -sa /); do
for snap in $(btrfs subvolume list -sa "${btrfssubvolsort}" /); do
IFS=$oldIFS
snap=($snap)
local snap_path_name=${snap[@]:13:${#snap[@]}}
@@ -249,6 +257,7 @@ title_format()
list_kernels_initramfs()
{
IFS=$'\n'
c=0
for item in $(snapshot_list); do
IFS=$oldIFS
item=($item)
@@ -276,6 +285,10 @@ list_kernels_initramfs()
title_format
# echo "${title_menu[*]}"
snapshots_entry
c=$((1+$c))
if [[ $c -gt $limit ]]; then
break;
fi
done
IFS=$oldIFS
}
@@ -292,4 +305,4 @@ if [ ${choise_of_method} = "1" ] ; then
umount $gbgmp
gettext_printf "###### - Grub-btrfs: Auto-detect - ######\n" >&2 ;
fi
### End choice of method ###
### End choice of method ###

View File

@@ -54,7 +54,15 @@ Add this lines to /etc/default/grub:
(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 )