Skip to content

Commit

Permalink
Merge pull request #81 from itoffshore/option
Browse files Browse the repository at this point in the history
Add urlwatch / archive option -a / improve rebuild option -r
  • Loading branch information
itoffshore authored Aug 23, 2024
2 parents 2406a93 + ffbc1c8 commit 2c718ae
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version [0.7.4] - 20240823
- add urlwatch examples
- improve kernel rebuild list / add archive option -a

Version [0.7.3] - 20240426
- fix post_install() detection of lkrg kernel module
- update linux-hardened.patch for kernel 6.8
Expand Down
18 changes: 14 additions & 4 deletions scripts/abk
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Usage: $script [OPTIONS]
[ -b ] : build [ kernel-name ]
[ -i ] : install [ kernel-name / AUR pkgname ]
[ -r ] : rebuild [ kernel-name ]
[ -a ] : archive [ kernel-name ]
[ -y ] : yes ( assume YES answers during build stage )
[ -c ] : clean [ /path/to/directory ] ( quickly with rsync )
[ -s ] : clean makepkg source dir selectively ( $(parse_makepkg SRCDEST) )
Expand Down Expand Up @@ -82,6 +83,10 @@ To rebuild a previous kernel PKGBUILD that abk archived in \$BUILD_DIR/kernel-ve
----------------------------------------------------------------------------------------
$script -r linux-hardened
To archive & version (but not build) your current \$BUILD_DIR/kernel-name:
-------------------------------------------------------------------------
$script -a linux-hardened
Utilities:
--------------------------
$script -c /path/to/somewhere
Expand Down Expand Up @@ -420,7 +425,7 @@ update_kernel() {

# backup old config
if [ "$archive" != "nobackup" ]; then
archive_config "$KERNEL"
archive_config
fi

# clean old config
Expand Down Expand Up @@ -501,8 +506,9 @@ rebuild_kernel() {

tmp=$(mktemp)

# find output in date order
kern_list=$(find "$BUILD_DIR" -maxdepth 1 -type f -regextype posix-extended \
-regex ".*$KERNEL\-[0-9\.]+.*.tar.xz" | sort)
-regex ".*$KERNEL\-[0-9\.]+.*.tar.xz" -printf "%T+ %p\n" | sort | awk '{print $2}')

# print kernel archive menu
if [ -n "$kern_list" ]; then
Expand Down Expand Up @@ -535,7 +541,6 @@ rebuild_kernel() {
echo

# unpack archived PKGBUILD & run a build
archive_config
tar -xJf "$kernel_rebuild"
time build_kernel
}
Expand Down Expand Up @@ -684,6 +689,10 @@ patch_pkgbuild() {
if patch -s -p0 --dry-run < "$patch_file"; then

msg "$(patch -p0 < "$patch_file")"

# backup new patched config
archive_config

msg2 "Ready to run: $0 -b $KERNEL <ENTER>"; read -r ans

case "$ans" in
Expand Down Expand Up @@ -800,7 +809,7 @@ get_options() {
# check build dir & editors
check_config

while getopts ":u:b:i:r:c:w:hsloy" opt
while getopts ":u:b:i:r:a:c:w:hsloy" opt

do
if [ -n "${OPTARG}" ]; then
Expand All @@ -814,6 +823,7 @@ get_options() {
b) KERNEL=${OPTARG}; check_kernel build; time build_kernel ;;
i) KERNEL=${OPTARG}; check_kernel install; install_kernel ;;
r) KERNEL=${OPTARG}; check_kernel rebuild; rebuild_kernel ;;
a) KERNEL=${OPTARG}; check_kernel rebuild; archive_config ;;
y) AUTOMATED='Y' ;;
c) check_args "$opt" dir "$arg" ; clean_dir "$arg" sources ;;
s) clean_sources ;;
Expand Down
4 changes: 4 additions & 0 deletions urlwatch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# urlwatch kernel alerts #

* example files to go in ~/.config/urlwatch for urlwatch to give alerts on kernel changes with a cron example
* [https://urlwatch.readthedocs.io](https://urlwatch.readthedocs.io)
26 changes: 26 additions & 0 deletions urlwatch/urls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ~/.config/urlwatch/urlwatch.yaml #
####################################
---
name: "linux-lts"
url: "https://archlinux.org/packages/core/x86_64/linux-lts/"
filter:
- element-by-tag: title
---

name: "linux-hardened"
url: "https://www.archlinux.org/packages/extra/x86_64/linux-hardened/"
filter:
- element-by-tag: title
---

name: "linux-zen"
url: "https://www.archlinux.org/packages/extra/x86_64/linux-zen/"
filter:
- element-by-tag: title
---

name: "linux"
url: "https://archlinux.org/packages/core/x86_64/linux/"
filter:
- element-by-tag: title
---
23 changes: 23 additions & 0 deletions urlwatch/urlwatch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ~/.config/urlwatch/urlwatch.yaml #
####################################

display:
empty-diff: true
error: false
new: true
unchanged: false
job_defaults:
all: {}
browser: {}
shell: {}
url:
ignore_connection_errors: true
report:

...

# various alert options email / xmpp / others
# https://urlwatch.readthedocs.io/en/latest/reporters.html
#
# crontab -e (check kernels every 2 hours)
# 0 0-23/2 * * * /usr/bin/urlwatch

0 comments on commit 2c718ae

Please sign in to comment.