ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: ALT Linux Sisyphus discussion list <sisyphus@altlinux.ru>
Subject: [sisyphus] AptRpm (was: LTSP.RU)
Date: Mon, 12 Apr 2004 16:43:00 +0300
Message-ID: <20040412134300.GB26922@osdn.org.ua> (raw)
In-Reply-To: <407A9070.8080209@l14.ru>


[-- Attachment #1.1: Type: text/plain, Size: 392 bytes --]

On Mon, Apr 12, 2004 at 04:49:52PM +0400, Алексей Любимов wrote:
> а также глянуть начавшийся порт этой темы  
> http://www.linux-os.ru/wiki/AptRpm

О, а мож туда еще пару скриптиков добавить -- для синхронизации
компонент с повтором до победы или max_attempts и для создания
снапшотов сизифа?

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/

[-- Attachment #1.2: rsync-all.sh --]
[-- Type: text/plain, Size: 1224 bytes --]

#!/bin/sh
RSYNC_RSH=rsh
MAXATTEMPTS=5
TMOUT1=500
TMOUT2=15
SRCROOT=rsync://rsync.altlinux.ru/ALTLinux	# 2003-04-15
#SRCROOT=rsync://ibiblio.org/Linux/distributions/altlinux	# 2002-12-07
#SRCROOT=rsync://ftp.leo.org/ALTLinux	# 2002-12-09
DESTROOT=~ftp/pub/Linux/ALT
#LIST="updates Sisyphus Mozilla OpenOffice"
LIST="updates Sisyphus Mozilla "
#LIST="updates"
RSYNC=/usr/bin/rsync
RSYNCARGS="-rltgoDuz --partial --timeout=$TMOUT1 --delete --delete-after"
RSHOME=~/rsync
MAINTAINER=mike@osdn.org.ua

for mirror in $LIST; do
	OK=
	attempt=1
	LOG=$RSHOME/rsync-$mirror.log
	LOCK=$RSHOME/lock.$mirror
	FLAG=$DESTROOT/$mirror/__SYNCING__
	date >> $LOG
	[ -f $LOCK ] && {
		ps auxww | grep rsync | mail -s "OSDN: $mirror: lockfile exists" $MAINTAINER
		echo "Lockfile for $mirror exists, quitting" >> $LOG
		continue
	}
	trap "rm -f $LOCK; exit 1" INT
	touch $LOCK $FLAG
	while [ -z "$OK" -a $attempt -lt $MAXATTEMPTS ]; do 
		$RSYNC $RSYNCARGS $* $SRCROOT/$mirror/ $DESTROOT/$mirror \
			>> $LOG 2>&1 && OK=1
		sleep $TMOUT2
		attempt=$(($attempt+1))
	done
	[ -z "$OK" ] && {
		tail $LOG | mail -s "OSDN: $mirror trouble" $MAINTAINER
	} || {
		rm -f $FLAG
	}
	rm -f $LOCK
	date >> $LOG
done

nice symlinks -dr $DESTROOT >/dev/null

[-- Attachment #1.3: daily-rsync.sh --]
[-- Type: text/plain, Size: 1362 bytes --]

#!/bin/sh
# script by Michael Shigorin <mike@osdn.org.ua> for snapshotting
# ALT Linux Sisyphus locally; feel free to use and modify, would
# be glad to hear back about changes

# mirror/site-specific
SRC="ftp.altlinux.org.ua::ALTLinux/Sisyphus/"
BASEDIR="/var/ftp/pub/EMT/Sisyphus/"

# retry params
MAXCOUNT=5
TIMEOUT=60

# shouldn't need to be changed
DATE=`date +%Y%m%d`
LOGDIR="$BASEDIR/log/"
LOGFILE="$LOGDIR/$DATE.log"
DEST="$BASEDIR/.syncing/"

RSYNCARGS="-av --partial --delete"

RPMARGS="-qp --queryformat %{RELEASE}\n"
TAGFILE="$DEST/files/i586/RPMS/altlinux-release-Sisyphus-alt*.noarch.rpm"

unset OK

# init env
mkdir -p "$BASEDIR" "$LOGDIR"
cd "$BASEDIR"

# create hardlinked copy or init dir; order critical
LAST=`ls -d1 20?????? 2>/dev/null | tail -1`
rm -rf "$DEST"
[ -n "$LAST" ] && cp -al "$LAST" "$DEST" || mkdir -p "$DEST"

# try to sync up
for attempt in `seq 1 $MAXCOUNT`; do 
	rsync $RSYNCARGS "$SRC" "$DEST" 2>&1 >> "$LOGFILE" && {
		OK="yes"
		break
	}
	sleep "$TIMEOUT"
done

[ -z "$OK" ] && exit 1

# get timestamp from specific package and move to it
TIMESTAMP=`rpm $RPMARGS $TAGFILE | tail -1 | sed 's/alt//'`

[ ! -d "$TIMESTAMP" ] && {
	mv "$DEST" "$TIMESTAMP"
	touch -d "$DATE" "$TIMESTAMP"
	# fix symlink
	rm -f current
	ln -s "$TIMESTAMP" current
} || rm -rf "$DEST"

# that's all :)
echo "** $TIMESTAMP sync OK" >> "$LOGFILE"

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-04-12 13:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-12  5:18 [sisyphus] LTSP.RU Ivan Fedorov
2004-04-12  9:21 ` [sisyphus] LTSP.RU Michael Shigorin
2004-04-12 12:49   ` Алексей Любимов
2004-04-12 13:43     ` Michael Shigorin [this message]
2004-04-12 14:19       ` [sisyphus] AptRpm Алексей Любимов

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040412134300.GB26922@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=sisyphus@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git