wok-tiny view rsync/receipt @ rev 92

base-tiny: may reuse passwd
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jul 18 13:11:03 2013 +0000 (2013-07-18)
parents a6d2ddc65590
children 371673f39e46
line source
1 # SliTaz package receipt.
3 PACKAGE="rsync"
4 VERSION="3.0.9"
5 CATEGORY="network"
6 SHORT_DESC="Utility that provides fast incremental."
7 MAINTAINER="pankso@slitaz.org"
8 LICENSE="GPL"
9 [ -n "$TARGET" ] || TARGET="i486"
10 BUILD_DEPENDS="uclibc-cross-compiler-$TARGET"
11 DEPENDS=""
12 TARBALL="$PACKAGE-$VERSION.tar.gz"
13 WEB_SITE="http://rsync.samba.org/"
14 WGET_URL="${WEB_SITE}ftp/$PACKAGE/$TARBALL"
15 CONFIG_FILES="/etc/rsyncd.conf /etc/rsyncd.secrets"
17 # Rules to configure and make the package.
18 compile_rules()
19 {
20 cd $src
21 sed -i 's/cross_compiling=no/cross_compiling=yes/' configure.sh
22 ./configure CC=uclibc-$TARGET-cc --host=i486-pc-linux-gnu \
23 --prefix=/usr \
24 --mandir=/usr/share/man \
25 --disable-iconv --disable-iconv-open \
26 --disable-acl-support --disable-xattr-support \
27 --with-included-popt --disable-debug \
28 $CONFIGURE_ARGS
29 sed -i -e 's/HAVE_ICONV_H ./HAVE_ICONV_H 0/' \
30 -e 's/HAVE_ICONV_OPEN ./HAVE_ICONV_OPEN 0/' config.h
31 sed -i 's/-liconv//' Makefile
32 make &&
33 make DESTDIR=$PWD/_pkg install
34 }
36 # Rules to gen a SliTaz package suitable for Tazpkg.
37 genpkg_rules()
38 {
39 mkdir -p $fs/usr
40 cp -a $_pkg/usr/bin $fs/usr
41 # Config file is /etc/rsyncd.conf.
42 # User and passwd in /etc/rsyncd.secrets, syntax : user:passwd
43 #
44 cp -a stuff/etc $fs
45 chown root.root $fs/etc/init.d/*
46 chmod 0644 $fs/etc/rsyncd.conf
48 }
50 config_form()
51 {
52 [ "$START" == "on" ] && START="ckecked=ckecked " || START=
53 [ -n "$RSYNCD_CONF" ] || RSYNCD_CONF="$(cat $1/etc/rsyncd.conf)"
54 [ -n "$RSYNCD_SECRETS" ] || RSYNCD_SECRETS="$(cat $1/etc/rsyncd.secrets)"
55 cat <<EOT
56 <p>
57 <input type="checkbox" name="START" $START> start rsync daemon during boot
58 </p>
59 <fieldset>
60 <legend><i>/etc/rsyncd.conf</i></legend>
61 <textarea name="RSYNCD_CONF" rows="15" cols="60" wrap="off">
62 $RSYNCD_CONF
63 </textarea>
64 </fieldset>
65 <fieldset>
66 <legend><i>/etc/rsyncd.secrets</i></legend>
67 <textarea name="RSYNCD_SECRETS" cols="60" wrap="off">
68 $RSYNCD_SECRETS
69 </textarea>
70 </fieldset>
71 <fieldset>
72 <legend><i>/etc/rsyncd.motd</i></legend>
73 <textarea name="RSYNCD_MOTD" rows="10" cols="60" wrap="off">
74 $RSYNCD_MOTD
75 </textarea>
76 </fieldset>
77 EOT
78 }
80 config_note()
81 {
82 cat <<EOT
83 <script type="text/javascript">
84 function update_form()
85 {
86 var hide = true
87 for (var i = 0; i < document.forms.length; i++) {
88 for (var j = 0; j < document.forms[i].elements.length; j++) {
89 var obj = document.forms[i].elements[j]
90 if (obj.name == "START" && obj.checked == true)
91 hide = false
92 }
93 }
94 for (var i = 0; i < document.forms.length; i++) {
95 for (var j = 0; j < document.forms[i].elements.length; j++) {
96 var obj = document.forms[i].elements[j]
97 switch (obj.name) {
98 case "RSYNCD_CONF" :
99 case "RSYNCD_SECRETS" :
100 case "RSYNCD_MOTD" :
101 obj.disabled = hide; break;
102 }
103 }
104 }
105 }
106 update_form()
107 window.onchange = update_form
108 //-->
109 </script>
110 EOT
111 }
113 post_install()
114 {
115 if [ -n "$START" ]; then
116 cat > $1/etc/rsyncd.conf <<EOT
117 $RSYNCD_CONF
118 EOT
119 cat > $1/etc/rsyncd.secrets <<EOT
120 $RSYNCD_SECRETS
121 EOT
122 cat > $1/etc/rsyncd.motd <<EOT
123 $RSYNCD_MOTD
124 EOT
125 grep -q inetd $1/etc/rcS.conf ||
126 sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
127 grep -q rsync $1/etc/inetd.conf || cat >> $1/etc/inetd.conf <<EOT
128 rsync stream tcp nowait root /usr/bin/rsync /usr/bin/rsync --daemon
129 EOT
130 else
131 rm -f $1/etc/rsyncd.conf $1/etc/rsyncd.secrets \
132 $1/etc/init.d/rsyncd
133 fi
134 }