-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkat-managerepo.sh
78 lines (60 loc) · 1.66 KB
/
linkat-managerepo.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
source linkat-managerepo.conf
function createrepo {
cd "$FOLDER"/"$LINKATDIST"/"$REPO"/
#-- build Packages file
apt-ftparchive packages . > Packages
bzip2 -kf Packages
#-- signed Release file
apt-ftparchive release . > Release
gpg --yes -abs -o Release.gpg Release
cd $FOLDER
}
function syncrepo {
echo "----------Inici del rsync--------------"
echo "Inici Sync "$ORIGEN" a "$TARGET" de "$LINKATDIST""
echo "Visualitza "$DAY_LOG" per veure els logs"
date
rsync -avh --delete "$ORIGEN" "$TARGET" > "$DAY_LOG"
cat "$DAY_LOG" >> "$LOG"
echo "======================================="
echo "SyncRepo "$ORIGEN" -> "$TARGET" finalitzat"
date >> $LOG
echo -en "------------Fi del rsync---------------\n\n"
echo -en "Visualitza els logs a "$LOG"\n\n"
}
#function sendrepo {
#
# echo -en "******* START *******\n" >> "$LOG"
# date >> "$LOG"
# rsync -avh --delete "$TARGET"/ "$DESTIPRO"/ >> "$LOG"
# echo -en "******* END *******\n" >> "$LOG"
# echo -en "Visualitza els logs a "$LOG"\n\n"
#}
if [ "$ACTIONREPO" == create ]; then
##
## Protecció per generar sempre test primer
if [ "$REPO" == main ] || [ "$REPO" == extres ]; then
echo -en "Acció prohibida: No es permet generar els repos de producció directament.\n"
exit 1
fi
##
##
createrepo
fi
if [ "$ACTIONREPO" == sync ]; then
case "$REPO" in
main) ORIGEN="$FOLDER"/"$LINKATDIST"/test/
;;
extres) ORIGEN="$FOLDER"/"$LINKATDIST"/test-extres/
;;
test) ORIGEN="$FOLDER"/"$LINKATDIST"/dev/
;;
test-extres) ORIGEN="$FOLDER"/"$LINKATDIST"/dev-extres/
;;
*) echo -en "Error de sistaxis: El repo "$REPO" no es pot sincronitzar.\n"
exit 1
;;
esac
syncrepo
fi