-
Notifications
You must be signed in to change notification settings - Fork 197
/
old-hackage-download.sh
46 lines (37 loc) · 1.42 KB
/
old-hackage-download.sh
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
43
44
45
46
#!/bin/bash
# Script to get all the old hackage data
IMPORTDATA_DIR=./import-data
IMPORTDATA_DIR=$(realpath ${IMPORTDATA_DIR})
mkdir -p ${IMPORTDATA_DIR}/passwd/ ${IMPORTDATA_DIR}/archive/ ${IMPORTDATA_DIR}/docs/
echo "Syncing passwd files..."
rsync -r -v hackage.haskell.org:/srv/www/hackage.haskell.org/passwd/ ${IMPORTDATA_DIR}/passwd/
echo "Syncing archive..."
rsync -r -v -z --skip-compress=gz -f'- latest/' -f'- logs/' hackage.haskell.org:/srv/www/hackage.haskell.org/public_html/packages/archive/ ${IMPORTDATA_DIR}/archive/
echo "Syncing apache access logs..."
rsync -r -v -z --skip-compress=gz -f'- error.log*' hackage.haskell.org:/var/log/apache2/ ${IMPORTDATA_DIR}/download-logs/
echo "Updating doc tarballs..."
pushd ${IMPORTDATA_DIR}/docs
for docdir in ${IMPORTDATA_DIR}/archive/*/*/doc/
do
pkgverdir=$(dirname $docdir)
pkgver=$(basename $pkgverdir)
pkgname=$(basename $(dirname $pkgverdir))
docdir_new=${pkgname}-${pkgver}-docs
tarball=${docdir_new}.tar.gz
if [[ -d ${docdir}/html ]]; then
true
if ! [[ -h ${docdir_new} ]]; then
ln -f -s ${docdir}/html ${docdir_new}
fi
if ! [[ -f ${tarball} ]]; then
echo ${tarball}
tar -h -c ${docdir_new} -zf ${tarball} --exclude=frames.html --exclude=mini_* --owner=nobody --group=users --format=ustar
else
echo -n '.'
fi
else
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo ${docdir}/html does not exist
fi
done
popd