diff options
-rw-r--r-- | Makefile | 3 | ||||
-rwxr-xr-x | password-to-clipboard | 6 | ||||
-rw-r--r-- | update-all.in | 18 | ||||
-rw-r--r-- | update-me.in | 35 |
4 files changed, 44 insertions, 18 deletions
@@ -23,7 +23,7 @@ DESTDIR = ETCDIR = /etc BINDIR = /usr/bin -VERSION = 0.7.3 +VERSION = 0.8.7 all: update-all update-me @@ -34,6 +34,7 @@ all: update-all update-me .PHONY: install dist clean install: all + install -D -m0755 password-to-clipboard $(DESTDIR)$(BINDIR)/password-to-clipboard install -D -m0755 update-all $(DESTDIR)$(BINDIR)/update-all install -D -m0755 update-me $(DESTDIR)$(BINDIR)/update-me install -D -m0644 update-all.conf $(DESTDIR)$(ETCDIR)/update-all.conf diff --git a/password-to-clipboard b/password-to-clipboard new file mode 100755 index 0000000..0a52c72 --- /dev/null +++ b/password-to-clipboard @@ -0,0 +1,6 @@ +#!/bin/bash + +stty_orig=$(stty -g) +stty -echo +xclip +stty $stty_orig diff --git a/update-all.in b/update-all.in index 7b33884..6d36bb2 100644 --- a/update-all.in +++ b/update-all.in @@ -8,6 +8,7 @@ usage() { >&2 printf 'usage:\n' >&2 printf ' %s\n' "${0##*/}" + >&2 printf ' %s -c\n' "${0##*/}" >&2 printf ' %s $id $tmpdir [cs]\n' "${0##*/}" exit 1 } @@ -50,6 +51,14 @@ if [ "$#" -eq 3 ]; then exit ${err} fi +if [ "$#" -eq 1 ] \ +&& [ "x$1" = 'x-c' ]; then + for system in "${!systems[@]}"; do + screen -S update-clear-all -d -m "${0}" "${system}" "${tmp_dir}" 'c' + done + exit +fi + if [ "$#" -ne 0 ]; then usage fi @@ -62,12 +71,11 @@ pids=() for system in "${!systems[@]}"; do if [ -z "${DISPLAY}" ]; then screen -S update-all -d -m "${0}" "${system}" "${tmp_dir}" 's' - screen -S update-clear-all -d -m "${0}" "${system}" "${tmp_dir}" 'c' else - urxvt -title "${systems["${system}"]}: update-me" -e "${0}" "${system}" "${tmp_dir}" & + urxvt -title "${systems["${system}"]}: update-me" -e "${0}" "${system}" "${tmp_dir}" 's' & pids+=($!) - screen -S update-clear-all -d -m "${0}" "${system}" "${tmp_dir}" 'c' fi + screen -S update-clear-all -d -m "${0}" "${system}" "${tmp_dir}" 'c' done if [ -z "${DISPLAY}" ]; then @@ -87,7 +95,7 @@ fi while [ -n "${pids[*]}" ]; do if [ -z "${DISPLAY}" ]; then for pid in "${pids[@]}"; do - if ! kill -0 "${pid}" >/dev/null 2>&1; then + if ! [ -d "/proc/${pid}" ]; then continue fi npids+=("${pid}") @@ -100,7 +108,7 @@ while [ -n "${pids[*]}" ]; do pids=( $( for pid in "${pids[@]}"; do - if kill -0 "${pid}" >/dev/null 2>&1; then + if [ -d "/proc/${pid}" ]; then printf '%s\n' "${pid}" fi done diff --git a/update-me.in b/update-me.in index a2210a4..77bf0fc 100644 --- a/update-me.in +++ b/update-me.in @@ -42,6 +42,10 @@ preCmds=('uname -n') cmds=() postCmds=('sync') +if command -v simply-report-installed-packages >/dev/null; then + postCmds+=('simply-report-installed-packages') +fi + for mp in '/' '/boot'; do mountpoint -q "${mp}" || continue mount \ @@ -53,12 +57,12 @@ for mp in '/' '/boot'; do preCmds+=('mount -o remount,rw '"${mp}") if command -v shutdownasap >/dev/null; then if command -v screen >/dev/null; then - postCmds+=('mount -o remount,ro '"${mp}"' || screen -d -m shutdownasap -r') + postCmds+=('mount -o remount,ro '"${mp}"' || screen -d -m shutdownasap -R') else - postCmds+=('mount -o remount,ro '"${mp}"' || shutdownasap -r') + postCmds+=('mount -o remount,ro '"${mp}"' || shutdownasap -R') fi else - postCmds+=('mount -o remount,ro '"${mp}"' || reboot') + postCmds+=('bash -c "mount -o remount,ro '"${mp}"' || reboot"') fi done @@ -66,18 +70,25 @@ if command -v check-kernel >/dev/null; then postCmds+=('check-kernel -r') fi -if command -v /usr/share/archlinux/contrib/admin/checkservices >/dev/null; then - postCmds+=(/usr/share/archlinux/contrib/admin/checkservices) +if command -v checkservices >/dev/null \ +&& command -v systemctl >/dev/null; then + postCmds+=('checkservices') fi command_needs_root() { local cmd - cmd="$1" - cmd="${cmd%% *}" - cmd="${cmd##*/}" - if [ "${cmd}" = 'mount' ] \ - || [ "${cmd}" = 'checkservices' ] \ - || [ "${cmd}" = 'check-kernel' ]; then + cmd=$( + printf '%s\n' "$1" \ + | sed ' + s@^bash -c "\(.*\)"$@\1@ + s@ .*$@@ + s@^.*/@@ + ' + ) + if [ "${cmd}" = 'checkservices' ] \ + || [ "${cmd}" = 'check-kernel' ] \ + || [ "${cmd}" = 'mount' ] \ + || [ "${cmd}" = 'report-installed-packages' ]; then return 0 else return 1 @@ -167,7 +178,7 @@ then cmds=('pacman -Syu' 'pacdiff') elif [ -d '#ETCDIR#/ports' ] then - cmds=('ports -u' 'prt-get --install-scripts sysup' 'rejmerge' 'revdep') + cmds=('ports -u' 'prt-get --install-scripts sysup' 'rejmerge' 'revdep' 'makekernel') elif [ -d '#ETCDIR#/apt' ] then cmds=('apt-get update' 'apt-get upgrade' 'apt-get dist-upgrade' 'apt-get autoremove') |