[arch-commits] Commit in grub/trunk (10_archlinux PKGBUILD)

2014-02-25 Thread Tobias Powalowski
Date: Tuesday, February 25, 2014 @ 12:32:23
  Author: tpowa
Revision: 206398

upgpkg: grub 1:2.02.beta2-2

fix 10_archlinux to reduce issues with entries

Modified:
  grub/trunk/10_archlinux
  grub/trunk/PKGBUILD

--+
 10_archlinux |   49 +
 PKGBUILD |   11 ++-
 2 files changed, 43 insertions(+), 17 deletions(-)

Modified: 10_archlinux
===
--- 10_archlinux2014-02-25 11:30:45 UTC (rev 206397)
+++ 10_archlinux2014-02-25 11:32:23 UTC (rev 206398)
@@ -2,7 +2,8 @@
 
 ##
 ## grub-mkconfig helper script specific to Arch Linux
-## Contributed by Keshav Padram Amburay the ddoott ridikulus ddoott rat 
aatt geemmayil ddoott ccoomm
+## Contributed by Keshav Amburay the ddoott ridikulus ddoott rat aatt 
geemmayil ddoott ccoomm
+## Updated on 08 February 2014
 ##
 ## Script based on do_grub_config() function in Arch Linux Archboot ISO 
Installer/Setup script 
 ## Some parts taken from /etc/grub.d/10_linux script shipped by GRUB(2) 
upstream
@@ -64,20 +65,29 @@
 [[ ${grub_file} !=  ]]  _FUNC_GRUB_FILE_PRESENT
 
 BOOT_PART_FS_UUID=$(${grub_probe} --target=fs_uuid /boot 2/dev/null)
-BOOT_PART_HINTS_STRING=$(${grub_probe} --target=hints_string /boot 
2/dev/null)
+BOOT_PART_HINTS_STRING=$(${grub_probe} --target=hints_string /boot 
2/dev/null || true)
 BOOT_PART_FS=$(${grub_probe} --target=fs /boot 2/dev/null)
 
-ROOT_PART_FS_UUID=$(${grub_probe} --target=fs_uuid / 2/dev/null)
-ROOT_PART_HINTS_STRING=$(${grub_probe} --target=hints_string / 
2/dev/null)
-ROOT_PART_FS=$(${grub_probe} --target=fs / 2/dev/null)
+ROOT_PART_GRUB_DEVICE=$(${grub_probe} --target=device / || true)
+ROOT_PART_FS=$(${grub_probe} --device ${ROOT_PART_GRUB_DEVICE} --target=fs 2 
/dev/null || echo unknown)
 
-if [[ ${ROOT_PART_FS_UUID} == ${BOOT_PART_FS_UUID} ]]; then
-SUBDIR=/boot
-else
-SUBDIR=
-fi
-
 if [[ ${GRUB_LINUX_ROOT_DEVICE} ==  ]]; then
+
+case ${ROOT_PART_FS} in
+btrfs)
+rootsubvol=$(make_system_path_relative_to_its_root /)
+rootsubvol=${rootsubvol#/}
+if [[ ${rootsubvol} !=  ]]; then
+GRUB_LINUX_ROOT_DEVICE=subvol=${rootsubvol}
+fi
+;;
+zfs)
+rpool=$(${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 
2/dev/null || true)
+bootfs=$(make_system_path_relative_to_its_root / | sed -e 
s,@$,,)
+GRUB_LINUX_ROOT_DEVICE=ZFS=${rpool}${bootfs}
+;;
+esac
+
 if [[ ${GRUB_DEVICE_UUID} ==  ]] || \
[[ ${GRUB_DISABLE_LINUX_UUID} == true ]] || \
[[ ! -e /dev/disk/by-uuid/${GRUB_DEVICE_UUID} ]] || \
@@ -94,6 +104,10 @@
 
 echo Found linux image: ${_KERNEL_} 2
 
+basename=$(basename ${_KERNEL_})
+dirname=$(dirname ${_KERNEL_})
+REAL_DIR=$(make_system_path_relative_to_its_root ${dirname})
+  
 _KERNEL_FILE_=$(echo ${_KERNEL_} | sed 's,/boot/,,g')
 _KERNEL_PKG_=pkg-$(echo ${_KERNEL_FILE_} | sed 's,vmlinuz-,,g')
 
@@ -106,6 +120,7 @@
 cat  EOF
 
 menuentry Arch Linux ${_KERNEL_PKG_} kernel ${CLASS} {
+$(save_default_entry)
 if [ x\$feature_all_video_module = xy ]; then
 insmod all_video
 fi
@@ -117,9 +132,9 @@
 search --no-floppy --fs-uuid  --set=root ${BOOT_PART_FS_UUID}
 fi
 echo 'Loading Arch Linux ${_KERNEL_PKG_} kernel ...'
-linux ${SUBDIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw 
${GRUB_LINUX_PARAMS}
+linux ${REAL_DIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw 
${GRUB_LINUX_PARAMS}
 echo 'Loading Arch Linux ${_KERNEL_PKG_} kernel initramfs ...'
-initrd ${SUBDIR}/${_INITRAMFS_}
+initrd ${REAL_DIR}/${_INITRAMFS_}
 }
 
 EOF
@@ -134,6 +149,7 @@
 cat  EOF
 
 menuentry Arch Linux ${_KERNEL_PKG_} kernel (fallback initramfs) ${CLASS} {
+$(save_default_entry)
 if [ x\$feature_all_video_module = xy ]; then
 insmod all_video
 fi
@@ -145,9 +161,9 @@
 search --no-floppy --fs-uuid  --set=root ${BOOT_PART_FS_UUID}
 fi
 echo 'Loading Arch Linux ${_KERNEL_PKG_} kernel ...'
-linux ${SUBDIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw 
${GRUB_LINUX_PARAMS}
+linux ${REAL_DIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw 
${GRUB_LINUX_PARAMS}
 echo 'Loading Arch Linux ${_KERNEL_PKG_} kernel fallback initramfs ...'
-initrd ${SUBDIR}/${_INITRAMFS_FALLBACK_}
+initrd ${REAL_DIR}/${_INITRAMFS_FALLBACK_}
 }
 
 EOF
@@ -157,6 +173,7 @@
 cat  EOF
 
 menuentry Arch Linux ${_KERNEL_PKG_} kernel (no initramfs) ${CLASS} {
+$(save_default_entry)
 if [ x\$feature_all_video_module = xy ]; then
 insmod all_video
 fi
@@ -168,7 +185,7 @@
 search --no-floppy --fs-uuid  --set=root ${BOOT_PART_FS_UUID}
 fi
 echo 'Loading Arch Linux ${_KERNEL_PKG_} kernel ...'
-linux ${SUBDIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw 
${GRUB_LINUX_PARAMS}
+

[arch-commits] Commit in grub/trunk (10_archlinux PKGBUILD)

2014-01-05 Thread Tobias Powalowski
Date: Sunday, January 5, 2014 @ 20:13:56
  Author: tpowa
Revision: 203213

upgpkg: grub 1:2.02.beta2-1

bump to latest version

Modified:
  grub/trunk/10_archlinux
  grub/trunk/PKGBUILD

--+
 10_archlinux |   61 -
 PKGBUILD |7 ++
 2 files changed, 51 insertions(+), 17 deletions(-)

Modified: 10_archlinux
===
--- 10_archlinux2014-01-05 18:28:05 UTC (rev 203212)
+++ 10_archlinux2014-01-05 19:13:56 UTC (rev 203213)
@@ -18,11 +18,38 @@
 ## GNU General Public License for more details.
 ##
 
+_FUNC_GRUB_FILE_PRESENT() {
+
+[[ -z ${GRUB_PLATFORM} ]]  GRUB_PLATFORM=x86
+
+if [[ ${GRUB_PLATFORM} == x86 ]]; then
+check=--is-x86-linux32
+elif [[ ${GRUB_PLATFORM} == i386-xen-pae ]]; then
+check=--is-i386-xen-pae-domu
+elif [[ ${GRUB_PLATFORM} == x86_64-xen ]]; then
+check=--is-x86_64-xen-domu
+else
+check=--is-${GRUB_PLATFORM}-linux
+fi
+
+case ${GRUB_PLATFORM} in
+x86)
+list=$(for i in ${GRUB_ROOT}/boot/vmlinuz-linux* ; do
+if grub_file_is_not_garbage ${i}  ${grub_file} 
${check} ${i} ; then echo -n ${i}  ; fi
+done) ;;
+*) 
+  list=$(for i in ${GRUB_ROOT}/boot/vmlinuz-linux* ; do
+  if grub_file_is_not_garbage ${i}  ${grub_file} 
${check} ${i} ; then echo -n ${i}  ; fi
+  done) ;;
+esac
+}
+
 set -e
 
 prefix=/usr
-exec_prefix=/usr
+exec_prefix=${prefix}
 datarootdir=/usr/share
+datadir=${datarootdir}
 sysconfdir=/etc
 
 . ${datarootdir}/grub/grub-mkconfig_lib
@@ -34,14 +61,16 @@
 
 CLASS=--class arch-linux --class arch --class gnu-linux --class gnu --class 
os
 
-BOOT_PART_FS_UUID=$(grub-probe --target=fs_uuid /boot 2/dev/null)
-BOOT_PART_HINTS_STRING=$(grub-probe --target=hints_string /boot 
2/dev/null)
-BOOT_PART_FS=$(grub-probe --target=fs /boot 2/dev/null)
+[[ ${grub_file} !=  ]]  _FUNC_GRUB_FILE_PRESENT
 
-ROOT_PART_FS_UUID=$(grub-probe --target=fs_uuid / 2/dev/null)
-ROOT_PART_HINTS_STRING=$(grub-probe --target=hints_string / 2/dev/null)
-ROOT_PART_FS=$(grub-probe --target=fs / 2/dev/null)
+BOOT_PART_FS_UUID=$(${grub_probe} --target=fs_uuid /boot 2/dev/null)
+BOOT_PART_HINTS_STRING=$(${grub_probe} --target=hints_string /boot 
2/dev/null)
+BOOT_PART_FS=$(${grub_probe} --target=fs /boot 2/dev/null)
 
+ROOT_PART_FS_UUID=$(${grub_probe} --target=fs_uuid / 2/dev/null)
+ROOT_PART_HINTS_STRING=$(${grub_probe} --target=hints_string / 
2/dev/null)
+ROOT_PART_FS=$(${grub_probe} --target=fs / 2/dev/null)
+
 if [[ ${ROOT_PART_FS_UUID} == ${BOOT_PART_FS_UUID} ]]; then
 SUBDIR=/boot
 else
@@ -61,7 +90,7 @@
 
 [[ ${GRUB_LINUX_PARAMS} ==  ]]  GRUB_LINUX_PARAMS=${GRUB_CMDLINE_LINUX} 
${GRUB_CMDLINE_LINUX_DEFAULT}
 
-for _KERNEL_ in $(ls /boot/vmlinuz-linux*) ; do
+for _KERNEL_ in ${list} ; do
 
 echo Found linux image: ${_KERNEL_} 2
 
@@ -77,7 +106,9 @@
 cat  EOF
 
 menuentry Arch Linux ${_KERNEL_PKG_} kernel ${CLASS} {
-load_video
+if [ x\$feature_all_video_module = xy ]; then
+insmod all_video
+fi
 set gfxpayload=keep
 insmod ${BOOT_PART_FS}
 if [ x\$feature_platform_search_hint = xy ]; then
@@ -88,7 +119,7 @@
 echo 'Loading Arch Linux ${_KERNEL_PKG_} kernel ...'
 linux ${SUBDIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw 
${GRUB_LINUX_PARAMS}
 echo 'Loading Arch Linux ${_KERNEL_PKG_} kernel initramfs ...'
-initrd ${subdir}/${_INITRAMFS_}
+initrd ${SUBDIR}/${_INITRAMFS_}
 }
 
 EOF
@@ -103,7 +134,9 @@
 cat  EOF
 
 menuentry Arch Linux ${_KERNEL_PKG_} kernel (fallback initramfs) ${CLASS} {
-load_video
+if [ x\$feature_all_video_module = xy ]; then
+insmod all_video
+fi
 set gfxpayload=keep
 insmod ${BOOT_PART_FS}
 if [ x\$feature_platform_search_hint = xy ]; then
@@ -114,7 +147,7 @@
 echo 'Loading Arch Linux ${_KERNEL_PKG_} kernel ...'
 linux ${SUBDIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw 
${GRUB_LINUX_PARAMS}
 echo 'Loading Arch Linux ${_KERNEL_PKG_} kernel fallback initramfs ...'
-initrd ${subdir}/${_INITRAMFS_FALLBACK_}
+initrd ${SUBDIR}/${_INITRAMFS_FALLBACK_}
 }
 
 EOF
@@ -124,7 +157,9 @@
 cat  EOF
 
 menuentry Arch Linux ${_KERNEL_PKG_} kernel (no initramfs) ${CLASS} {
-load_video
+if [ x\$feature_all_video_module = xy ]; then
+insmod all_video
+fi
 set gfxpayload=keep
 insmod ${BOOT_PART_FS}
 if [ x\$feature_platform_search_hint = xy ]; then

Modified: PKGBUILD
===
--- PKGBUILD2014-01-05 18:28:05 UTC (rev 203212)
+++ PKGBUILD2014-01-05 19:13:56 UTC (rev 203213)
@@ -3,7 +3,7 @@
 # Contributor: Keshav Padram Amburay (the ddoott ridikulus ddoott rat) (aatt) 
(gemmaeiil) (ddoott) (ccoomm)
 
 _pkgver=2.02