package-all-acpi_call-tp_smapi 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/bash
  2. readonly KERNEL_VER=6.5.8
  3. readonly KERNEL_LTS_VER=5.15.88
  4. readonly CHROOT_NAMES=( armv7h i686 x86_64 )
  5. readonly ABS_ROOT=/var/lib/archbuild/abslibre # no spaces
  6. readonly ABS_UPSTREAM=parabola
  7. readonly PKG_DIRS=( ${ABS_ROOT}/libre/acpi_call{-dkms,,-lts} # -dkms first
  8. ${ABS_ROOT}/libre/tp_smapi{,-lts} ) # no trailing slashes
  9. readonly PKGBUILDS=( ${PKG_DIRS[*]/%/\/PKGBUILD} )
  10. Main()
  11. {
  12. local chroot pkg_dir kver pkgname pkgver pkgrel arches chroot_dir arch
  13. local pkgs=()
  14. local all_pkgs=()
  15. local commit_msg=''
  16. echo -e "\nupgrading chroots\n"
  17. for chroot in ${CHROOT_NAMES[*]}
  18. do sudo librechroot -n ${chroot} update || exit 1
  19. done
  20. echo -e "\nbuilding packages\n"
  21. for pkg_dir in ${PKG_DIRS[*]}
  22. do kver=$( [[ "${pkg_dir}" =~ -lts$ ]] && echo ${KERNEL_LTS_VER} || echo ${KERNEL_VER} )
  23. pkgs=()
  24. [[ -d "${pkg_dir}" && -f "${pkg_dir}"/PKGBUILD ]] ||
  25. ! echo "${pkg_dir} - no such PKGBUILD" || continue
  26. cd ${pkg_dir}/ ; git checkout HEAD PKGBUILD &> /dev/null ;
  27. pkgname=$(source PKGBUILD ; echo ${pkgname} ;)
  28. pkgver=$( source PKGBUILD ; echo ${pkgver} ;)
  29. pkgrel=$( source PKGBUILD ; echo ${pkgrel} ;)
  30. arches="$(source PKGBUILD ; echo ${arch[*]} ;)"
  31. ! [[ "${pkgrel}" =~ \.basekernel${kver}$ ]] ||
  32. ! echo "${pkg_dir} - skipping PKGBUILD" || continue
  33. sed -i "s|^_basekernel=.*|_basekernel=${kver}|" PKGBUILD
  34. pkgrel=$( source PKGBUILD ; echo ${pkgrel} ;)
  35. [[ "${pkgrel}" =~ \.basekernel${kver}$ ]] ||
  36. ! echo "ERROR: ${pkg_dir} - PKGBUILD not modified" || continue
  37. for chroot in ${CHROOT_NAMES[*]}
  38. do chroot_dir=$(librechroot -n ${chroot} |& grep -E 'copydir +: ' | cut -d: -f2)
  39. arch=$(source ${chroot_dir}/etc/os-release ; sed 's|-.*||' <<<${VARIANT_ID})
  40. [[ -n "${arch}" && " ${arches} " =~ " ${arch} " ]] || continue
  41. echo "building pkgname: ${pkgname} in chroot: ${chroot}"
  42. sudo libremakepkg -n ${chroot}
  43. pkgs+=( $(ls ${pkgname}-${pkgver}-${pkgrel}-${arch}.pkg.tar.zst 2> /dev/null) )
  44. done
  45. if (( ${#pkgs[*]} ))
  46. then all_pkgs+=( ${pkgs[*]} )
  47. commit_msg+="[$(basename ${pkg_dir})]"
  48. else echo "ERROR: ${pkg_dir} - no packages generated"
  49. fi
  50. done
  51. if (( ${#all_pkgs[*]} ))
  52. then git commit -m "${commit_msg}: rebuild against latest kernels" ${PKGBUILDS[*]}
  53. fi
  54. echo "(${#all_pkgs[*]}) packages generated" ; printf "%s\n" ${all_pkgs[*]} ;
  55. }
  56. if git pull $ABS_UPSTREAM master &> /dev/null
  57. then Main
  58. else echo "failed to synchronize abslibre VCS - is the working tree dirty?"
  59. fi