ACCC1380 commited on
Commit
e34de68
1 Parent(s): 26da14b

Upload etc/cron.daily/dpkg with huggingface_hub

Browse files
Files changed (1) hide show
  1. etc/cron.daily/dpkg +36 -0
etc/cron.daily/dpkg ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ dbdir=/var/lib/dpkg
4
+
5
+ # Backup the 7 last versions of dpkg databases containing user data.
6
+ if cd /var/backups ; then
7
+ # We backup all relevant database files if any has changed, so that
8
+ # the rotation number always contains an internally consistent set.
9
+ dbchanged=no
10
+ dbfiles="arch status diversions statoverride"
11
+ for db in $dbfiles ; do
12
+ if ! cmp -s "dpkg.${db}.0" "$dbdir/$db"; then
13
+ dbchanged=yes
14
+ break;
15
+ fi
16
+ done
17
+ if [ "$dbchanged" = "yes" ] ; then
18
+ for db in $dbfiles ; do
19
+ [ -e "$dbdir/$db" ] || continue
20
+ cp -p "$dbdir/$db" "dpkg.$db"
21
+ savelog -c 7 "dpkg.$db" >/dev/null
22
+ done
23
+ fi
24
+
25
+ # The alternatives database is independent from the dpkg database.
26
+ dbalt=alternatives
27
+
28
+ # XXX: Ideally we'd use --warning=none instead of discarding stderr, but
29
+ # as of GNU tar 1.27.1, it does not seem to work reliably (see #749307).
30
+ if ! test -e ${dbalt}.tar.0 ||
31
+ ! tar -df ${dbalt}.tar.0 -C $dbdir $dbalt >/dev/null 2>&1 ;
32
+ then
33
+ tar -cf ${dbalt}.tar -C $dbdir $dbalt >/dev/null 2>&1
34
+ savelog -c 7 ${dbalt}.tar >/dev/null
35
+ fi
36
+ fi