/[gentoo-alt]/trunk/net-ftp/ftpbase/ftpbase-0.00.ebuild
Gentoo

Contents of /trunk/net-ftp/ftpbase/ftpbase-0.00.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 726 - (show annotations) (download)
Thu Sep 1 07:46:07 2005 UTC (9 years, 3 months ago) by flameeyes
File size: 2668 byte(s)
Added ftpbase with egethome workaround for FreeBSD and Darwin.

1 # Copyright 1999-2005 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header$
4
5 inherit eutils pam
6
7 DESCRIPTION="FTP layout package"
8 SRC_URI=""
9 HOMEPAGE="http://www.gentoo.org/"
10
11 LICENSE="GPL-2"
12 SLOT="0"
13 KEYWORDS="alpha amd64 hppa ia64 ~mips ppc ppc64 s390 sparc x86"
14 IUSE="pam"
15
16 DEPEND="pam? ( || ( virtual/pam sys-libs/pam ) )
17 !<net-ftp/proftpd-1.2.10-r6
18 !<net-ftp/pure-ftpd-1.0.20-r2
19 !<net-ftp/vsftpd-2.0.3-r1"
20
21 S="${WORKDIR}"
22
23 # Gets the home for the specified user
24 egethome() {
25 ent=$(egetent passwd $1)
26
27 if [[ "${USERLAND}" == "Darwin" || ( "${USERLAND}" == "BSD" && "${ELIBC}" == "FreeBSD" ) ]]; then
28 # Darwin/OSX and FreeBSD uses position 9 to store the home dir
29 cut -d: -f9 <<<${ent}
30 else
31 # Linux and NetBSD uses position 6 instead
32 cut -d: -f6 <<<${ent}
33 fi
34 }
35
36 check_collision() {
37 [[ ! -e ${1} ]] && return 0
38
39 [[ $( head -n 1 "${1}" ) == $( head -n 1 "${2}" ) ]] && return 0
40
41 eerror "${1} exists and was not provided by ${P}"
42 return 1
43 }
44
45 pkg_setup() {
46 ebegin "Checking for possible file collisions..."
47 eindent
48
49 local collide=false
50 check_collision /etc/ftpusers "${FILESDIR}/ftpusers" || collide=true
51
52 if use pam ; then
53 check_collision /etc/pam.d/ftp "${FILESDIR}/ftp-pamd" || collide=true
54 fi
55
56 if ${collide} ; then
57 echo
58 einfo "Those files listed above have to be removed in order to"
59 einfo "install this version of ftpbase."
60 echo
61 ewarn "If you edited them, remember to backup and when restoring make"
62 ewarn " sure the first line in each file is:"
63 einfo $( head -n 1 "${FILESDIR}/ftpusers" )
64 eend 1
65 die "Can't be installed, files will collide"
66 fi
67
68 eend 0
69 }
70
71 src_install() {
72 # Add our default ftp user
73 enewgroup ftp 21
74 enewuser ftp 21 -1 /home/ftp ftp
75
76 # The ftpusers file is a list of people who are NOT allowed
77 # to use the ftp service.
78 insinto /etc
79 doins "${FILESDIR}/ftpusers"
80
81 # Ideally we would create the home directory here with a dodir.
82 # But we cannot until bug #9849 is solved - so we kludge in pkg_postinst()
83
84 if use pam ; then
85 if has_version "<sys-libs/pam-0.78" ; then
86 newpamd "${FILESDIR}/ftp-pamd" ftp
87 else
88 newpamd "${FILESDIR}/ftp-pamd-include" ftp
89 fi
90 fi
91 }
92
93 pkg_postinst() {
94 # Create our home directory if it doesn't exist and give a warning if we
95 # cannot.
96 # Install manually using install -d until bug #9849 is solved.
97 # This means that the home directory will not be removed when we uninstall
98 # if it's empty.
99 local homedir="${ROOT}$(egethome ftp)"
100 if [[ ! -d ${homedir} ]]; then
101 einfo "Creating home directory for ftp user"
102 einfo " ${homedir}"
103 install -d "${homedir}" \
104 || ewarn " can't create ${homedir}"
105 fi
106 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20