# /etc/pacman.conf
# See the pacman.conf(5) manpage for option and repository directives
# GENERAL OPTIONS
[options]
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
...
[core]
Server = http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch
[extra]
Server = http://ala.seblu.net/repos/2014/03/30/$repo/os/$arch
...
git clone https://github.com/seblu/archivetools.git
cd archivetools
makepkg -i
systemctl enable archive.timer
# Archlinux remote rsync server
ARCHIVE_RSYNC='rsync://polymorf.fr/archlinux/'
# Archive local directory
ARCHIVE_DIR='/srv/archive'
# Archive User and Group
ARCHIVE_USER=archive
ARCHIVE_GROUP=archive
# Package extensions
PKGEXT='.pkg.tar.xz'
PKGSIG="$PKGEXT.sig"
# Umask used when archiving
UMASK=022
#### Repositories
# Enable repositories archiving
ARCHIVE_REPO=1
# Enable daily repo trees
# This offer daily, weekly, monthly, yearly snapshot trees
REPO_DAYLY=1
# Enable packages tree
# Create a dedicated tree with packages sorted by name
REPO_PACKAGES=1
# Enable repository package index
# Needed by agetpkg to list packages
REPO_PACKAGES_INDEX=1
# Search in all repository snapshop. This is slow.
# Better option is to let it to 0 to look only in the last snapshot
REPO_PACKAGES_FULL_SEARCH=0
#### ISO
# Enable ISO archiving
ARCHIVE_ISO=1
[Unit]
Description=Archive Update
[Service]
Type=oneshot
EnvironmentFile=/etc/archive.conf
User=archive
Group=archive
ExecStart=/usr/bin/archive
[Unit]
Description=Daily Archive Update
[Timer]
OnCalendar=12:42:00
AccuracySec=1m
Persistent=true
[Install]
WantedBy=timers.target
Also=archive-hardlink.timer
[Unit]
Description=Archive Hardlinking
After=archive.service
[Service]
Type=oneshot
EnvironmentFile=/etc/archive.conf
User=archive
Group=archive
Nice=19
IOSchedulingClass=idle
ExecStart=/usr/bin/hardlink -Ocv ${ARCHIVE_DIR}
[Unit]
Description=Monthly Hardlinkng of Archive
[Timer]
OnCalendar=*-*-03 03:00:00
AccuracySec=1m
Persistent=true
[Install]
WantedBy=timers.target
archive.service
archive-hardlink.service
archive.timer
archive-hardlink.timer
# archlinux archive
# ala.seblu.net
server {
listen [::]:80;
listen 80;
server_name ala.seblu.net;
access_log /var/log/nginx/ala.seblu.net.access.log;
error_log /var/log/nginx/ala.seblu.net.error.log;
location / {
root /srv/http/archive;
autoindex on;
autoindex_exact_size off;
}
}
repo_rsync() {
msg "Snapshoting repositories"
# ...
# compute last but today
local LAST="$(ls -1d "$REPO_DIR"/2???/*/*|sort|grep -v $SNAPR|tail -n1)"
[[ -n "$LAST" ]] && local LINKDEST="--link-dest=$LAST/"
rsync -rltH $LINKDEST --exclude '*/.*' --exclude 'iso/*' "$ARCHIVE_RSYNC" "$SNAP/" ||
error "Unable to rsync: $ARCHIVE_RSYNC."
# ...
}
repo_packages_index() {
msg 'Updating package index'
# ...
find "$1" -name "*$PKGEXT" -printf '%f\n'|sed 's/.\{'${#PKGEXT}'\}$//'|sort|xz -9 > "$TMPINDEX"
# ...
}