Last active
April 30, 2021 09:16
-
-
Save deeagle/6ee1129a4e893d04c9ee98e69a7e0839 to your computer and use it in GitHub Desktop.
Revisions
-
deeagle revised this gist
Apr 30, 2021 . No changes.There are no files selected for viewing
-
deeagle revised this gist
Apr 30, 2021 . No changes.There are no files selected for viewing
-
deeagle created this gist
Apr 30, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ #!/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."