File: fai-mirror

package info (click to toggle)
fai 6.5.6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,076 kB
  • sloc: sh: 6,720; perl: 5,622; makefile: 138
file content (42 lines) | stat: -rw-r--r-- 1,334 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/bash

. ./debian/tests/common.sh
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
trap "cp -vp /tmp/mirror.log $AUTOPKGTEST_ARTIFACTS" INT QUIT EXIT
cd "$AUTOPKGTEST_TMP"

mdir=/tmp/mirror

chk-file /srv/fai/config/class/50-host-classes
du -sh /srv/fai/nfsroot /srv/fai/config
chk-size /srv/fai/nfsroot 700
chk-file /srv/fai/nfsroot/var/tmp/packages.nfsroot
chk-file /srv/fai/nfsroot/var/tmp/base-pkgs.lis

su $AUTOPKGTEST_NORMAL_USER -s /bin/bash -c "fai-mirror -s$CS -m1 -xARM64,I386,ROCKY,UBUNTU,FOCAL,CLOUD,CHROOT,STANDARD,NONFREE,GNOME $mdir >& /tmp/mirror.log"

# test the results of the commands called
chk-file $mdir
s=$(du -sm --exclude aptcache --exclude db $mdir | awk '{print $1}')
if [ $s -lt 420 ]; then
    error "$mdir is too small: $s MB"
else
    echo "OK: $mdir size is $s MB"
fi

find $mdir -name \*.deb > pkg.list
n=$(wc -l pkg.list | awk '{ print $1}')
if [ $n -lt 800 ]; then
    error "fai-mirror includes too few packages. Only $n found."
else
    echo "OK. Number of packages found in mirror: $n"
fi

# check some package names in the mirror
pkgs="linux-image- dracut-network_ xfce4-taskmanager_ xfdesktop4_ syslinux-common_ lvm2_ dracut-live_ dracut-squash_"
for p in $pkgs ; do
    echo Search for $p
    grep /$p pkg.list || error "$p not in mirror."
done

exit $error