Обновление хэш-файла при повторной проверке файлов

As a longtime sid user, where the possibility of an update breaking the system is a daily risk, here's my daily routine.

  1. In a root terminal with the GUI still running

apt update

apt full-upgrade -d

Now, stop and review carefully what is about to happen. First, look for removals. If anything is to be removed, that is your first and primary sign of danger. If it has been a long while (many days or weeks) since your last update, and you really want to get the system updated, then you need to research any package that is to be removed, using depends and rdepends and the information in Debian packages. Sometimes a package is obsoleted by introduction of a replacement package with a different name, so the prior package can safely be let go. But the more typical case is that a dependency will be broken by other upgraded packages, resulting in removal of something that you/your system needs, and that will break it. So, when you see removals, especially when your system has been updated in the recent past, it's safest and easiest to abort the full-upgrade with a "n", and try again tomorrow when it's (hopefully) safe.

  1. If it looks safe to proceed, answer "y" and let the packages be downloaded.

  2. Ctrl-Alt-F1 to the tty1 console, and log in as root.

systemctl isolate multi-user.target

Someone will soon post that this is not necessary. I'm not so sure. I'm not a software engineer and I don't wish to have any breakage in the xserver and GUI part of my systems. I have three fully updated sid systems that have been running error free since the last time some piece of hardware broke or got upgraded some years ago, so.....

4.

apt full-upgrade

apt clean

systemctl isolate graphical.target && exit

It has happened very rarely that, even with no packages removed, a buggy new package has broken sid systems. But this situation is pretty obvious and the fixed package comes in pretty quickly, so I doubt this would even happen in testing.

Источник:http://forums.debian.net/viewtopic.php?f=10&t=131073&p=633270#p633215

1
15.03.2020, 03:43
1 ответ

Создайте Makefileсо следующим содержимым:

SHAS := $(patsubst folder/%, sha/%, $(shell find folder/ -type f))

all: sha $(SHAS) checksumfolder.txt

sha:
    mkdir sha

sha/%: folder/%
    sha256sum $< > $@

checksumfolder.txt: $(SHAS)
    cat $(SHAS) > checksumfolder.txt

Теперь, когда вы запустите makeвнутри родительского каталога folder/, будет создан новый каталог sha/, содержащий sha256sum каждого файла в folder/. В конце мы объединяем все файлы в checksumfolder.txt.

Когда вы запустите makeво второй раз, ничего не будет сделано.

Когда вы прикасаетесь к файлу в folder/или создаете новый и запускаете make, сумма sha256 этого конкретного файла обновляется.

Чтобы узнать больше о make, запустите info make.


Если вы никогда не изменяете файл (, только добавляете новые ), вы можете просто запомнить имя файла с самым последним временем изменения, когда вы в последний раз запускали команду find, и выбирать только более новые файлы с помощью:

find -newer REFERENCE_FILE

… или прямая метка времени (см. дату (1 )СТРОКА ДАТЫ )с

find -newermt TIME_STAMP
0
28.04.2021, 23:20

Теги

Похожие вопросы