mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
proj/Makefile: Add target purge
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
de4a08f3d4
commit
1f11eedb75
2 changed files with 41 additions and 0 deletions
38
scripts/purge-stale-projects.sh
Normal file
38
scripts/purge-stale-projects.sh
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
local_cvs_proj=`ls -d */CVS 2>/dev/null | sed 's%/[^/]*%%'`
|
||||
local_git_proj=`ls -d */.git 2>/dev/null | sed 's%/[^/]*%%'`
|
||||
remote_cvs_proj=`ssh cvs.jannet.de find /home/jannet/arc/cvs/proj -type d -maxdepth 1 -mindepth 1 | sed 's%.*/%%'`
|
||||
remote_git_proj=`ssh git.jannet.de git-srv-admin.sh -j list-personal-projects`
|
||||
|
||||
date=`date +'%Y%m%d'`
|
||||
|
||||
for p in $local_cvs_proj; do
|
||||
[ -L $p ] && continue
|
||||
[ -d $p ] || continue
|
||||
echo $remote_cvs_proj | grep -q "\(^\| \)$p\($\| \)" && continue
|
||||
n=old/cvs/$date/$p
|
||||
mkdir -p `dirname $n`
|
||||
echo moving stale cvs project $p to $n
|
||||
mv $p $n
|
||||
purged="$purged $p"
|
||||
done
|
||||
|
||||
[ "$purged" ] && {
|
||||
cp -p CVS/Entries CVS/Entries-$date-`date +'%H%M%S'`
|
||||
}
|
||||
|
||||
for p in $purged; do
|
||||
sed -i "/D\/$p\/\/\/\// d" CVS/Entries
|
||||
done
|
||||
|
||||
for p in $local_git_proj; do
|
||||
[ -L $p ] && continue
|
||||
[ -d $p ] || continue
|
||||
echo $remote_git_proj | grep -q "\(^\| \)$p\($\| \)" && continue
|
||||
n=old/git/$date/$p
|
||||
mkdir -p `dirname $n`
|
||||
mv $p $n
|
||||
echo moving state git project $p to $n
|
||||
done
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue