Last active
April 30, 2021 09:16
-
-
Save deeagle/6ee1129a4e893d04c9ee98e69a7e0839 to your computer and use it in GitHub Desktop.
Simple log solution to do debian updates and get the problematic updates logged and run repair-debian-lib-XCRYPT_2.0.sh after (further details see: https://gist.github.com/deeagle/768bc0b50bf705e6edb027a04c14c076).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
XCRYPT_CHECK_BIN="/<path-to-folder>/repair-lib-xcrypt2.0.sh" | |
UPDATE_LIST_PATH="/tmp/debian-xcrypt_2.0-update-log.list" | |
UPDATE_LOG="/var/log/debian-xcrypt_2.0-update-log.log" | |
function log() { | |
local state=${1} | |
local msg=${2} | |
printf "%s [%s] %s\n" "$(date --rfc-3339=seconds)" "$@" | tee -a "${UPDATE_LOG}" | |
} | |
if [ "${EUID}" -ne 0 ]; then | |
echo "[ERR!]" "You must run the script as real root because of the repair command." | |
exit 2 | |
fi | |
log "INFO" "${0} started." | |
# reset list if exists | |
if test -e "${UPDATE_LIST_PATH}"; then | |
rm "${UPDATE_LIST_PATH}" | |
fi | |
# get list of packages to update | |
aptitude search -F '%p' --disable-columns '~U' | xargs -n 1 >> "${UPDATE_LIST_PATH}" | |
UPDATES=$(cat ${UPDATE_LIST_PATH}) | |
for UPDATE in ${UPDATES}; do | |
log "INFO" "Check update of package <${UPDATE}>" | |
aptitude install -yq "${UPDATE}" | |
bash "${XCRYPT_CHECK_BIN}" >/dev/null | |
if [ $? -ne 0 ]; then | |
log "ERR!" "XCRYPT error after update of package <${UPDATE}>" | |
bash "${XCRYPT_CHECK_BIN}" -r >/dev/null | |
fi | |
done | |
log "INFO" "${0} successfully finished." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Possible log looks like: