From 6113b0c20588bb8d58edf49ee9c2ba56c46b3504 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 5 Sep 2018 11:53:35 +0200 Subject: update-archlinux32-package new - serves my laziness --- update-archlinux32-package | 116 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100755 update-archlinux32-package diff --git a/update-archlinux32-package b/update-archlinux32-package new file mode 100755 index 0000000..33c9549 --- /dev/null +++ b/update-archlinux32-package @@ -0,0 +1,116 @@ +#!/bin/bash + +git_repo_path='/usr/src/archlinux32/packages/' +vagrant_path=$( + readlink -f ~/"virtual-boxes/archlinux32-test" +) +base_dir=$( + dirname "$( + readlink -f "$0" + )" +) +pkgname="$1" + +update_checksum() { + checksums=$( + ssh arch32-test ' + cd '"${pkgname}"' + makepkg -g + ' | \ + sed ' + $! s/$/\\n/ + ' | \ + tr -d '\n' + ) + sed -i ' + /^\S\+sums=(/{ + :a + N + /)/!ba + s/^\S\+sums=(.*)/'"${checksums}"'/ + } + ' "${git_repo_path}/${repo}/${pkgname}/PKGBUILD" +} + +if [ $# -ne 1 ]; then + >&2 echo 'usage: update-archlinux32-package $pkgname' + exit +fi + +if [ "${pkgname}" != 'linux-pae' ]; then + >&2 echo 'sry, this is not yet implemented - I only know "linux-pae".' + exit +fi + +infos=$( + "${base_dir}/watch-versions" "${pkgname}" +) + +if [ -z "${infos}" ]; then + >&2 echo 'Nothing to do.' + exit +fi + +old_pkgver=$( + printf '%s\n' "${infos}" | \ + cut -d' ' -f4 +) + +new_pkgver=$( + printf '%s\n' "${infos}" | \ + cut -d' ' -f2 +) + +repo=$( + readlink -f "${git_repo_path}"*"/${pkgname}" | \ + cut -d/ -f6 +) + +sed -i ' + s/^pkgver=.*$/pkgver='"'${new_pkgver}'"'/ + s/^pkgrel=.*$/pkgrel='"'1'"'/ +' "${git_repo_path}/${repo}/${pkgname}/PKGBUILD" + +if ssh -o ConnectTimeout=1 arch32-test true; then + vm_is_running=true +else + vm_is_running=false +fi + +if ! ${vm_is_running}; then + cd "${vagrant_path}" + vagrant up +fi + +scp -r "${git_repo_path}/${repo}/${pkgname}" 'arch32-test:' +update_checksum + +case "${pkgname}" in + 'linux-pae') + scp "${git_repo_path}/${repo}/${pkgname}/PKGBUILD" 'arch32-test:'"${pkgname}/" + ssh arch32-test ' + cd '"${pkgname}"' + sed -i '"'"' + /make oldconfig/ s/^\s*#// + s/^}$/return 1\n\0/ + '"'"' PKGBUILD + makepkg -fcrs --asdeps --noconfirm + cp src/linux-'"${new_pkgver}"'/.config config + ' + update_checksum + scp 'arch32-test:'"${pkgname}"'/config' "${git_repo_path}/${repo}/${pkgname}/" + git -C "${git_repo_path}/${repo}/${pkgname}" add 'PKGBUILD' 'config' + ;; + *) + >&2 printf 'Whoops, I thought I knew %s, but apparently I don'"'"'t.\n' \ + "${pkgname}" + exit + ;; +esac +ssh arch32-test 'rm -rf --one-file-system '"${pkgname}" + +git -C "${git_repo_path}" commit -m "${repo}/${pkgname}: ${old_pkgver} -> ${new_pkgver}" + +if ! ${vm_is_running}; then + ssh arch32-test 'sudo poweroff' +fi -- cgit v1.2.3