summaryrefslogtreecommitdiffstats
path: root/base/pkg-get/syn
blob: 42dd9a8b463af670c9c992d1a022f07da01b8bc9 (plain)
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
#!/bin/bash
MediaDepot=/media/cdrom/depot
Depot=/srv/NuTyX
if [ ! "$EUID" -eq 0 ]; then
	echo "Seul le compte root peut synchroniser les ports NuTyX"
	exit 1
fi
if [ ! -L /depot ]; then
	if [ ! -d $Depot/locale ]; then mkdir -p $Depot/locale; fi
	pushd $Depot/locale > /dev/null
	pkg-repgen
	popd
	for i in test release
	do
		if [ -a $Depot/$i ]; then
			rm -r $Depot/$i
		fi
	done
	pkg-get sync
	for i in `cat /etc/pkg-get.conf |grep -v ^#|grep http|cut -d "|" -f 1|cut -d" " -f2|cut -d"/" -f4`
	do
	if [ -d $MediaDepot/$i ]; then
		echo "Dépot $i trouvé sur le media"
		rm -r $Depot/$i > /dev/null 2>&1
		mkdir -p $Depot/$i
		for j in $MediaDepot/$i/*.gz 
		do
			fj=`basename $j`
			ln -svf $MediaDepot/$i/$fj $Depot/$i/$fj > /dev/null
		done
		cp $MediaDepot/$i/PKG* $Depot/$i/
	fi
	done
else
	for i in `cat /etc/pkg-get.conf |grep -v ^#|grep http|cut -d "|" -f 1|cut -d" " -f2|cut -d"/" -f4`
	do
		rsync -avuz --delete-before rsync://nutyx.meticul.eu/nutyx/2009/i686/$i/ $Depot/$i/
	done
fi