/[gentoo-x86]/app-admin/webmin/webmin-1.560-r1.ebuild
Gentoo

Contents of /app-admin/webmin/webmin-1.560-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Sun Jul 22 19:47:28 2012 UTC (2 years, 4 months ago) by hwoarang
Branch: MAIN
Changes since 1.2: +2 -2 lines
Fix LICENSE once again. BSD and GPL-2 should both be set unconditionally

(Portage version: 2.1.11.9/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/app-admin/webmin/webmin-1.560-r1.ebuild,v 1.2 2012/07/22 09:03:02 hwoarang Exp $
4
5 EAPI="3"
6
7 inherit eutils pam ssl-cert
8
9 DESCRIPTION="A web-based Unix systems administration interface"
10 HOMEPAGE="http://www.webmin.com/"
11 SRC_URI="minimal? ( mirror://sourceforge/webadmin/${P}-minimal.tar.gz )
12 !minimal? ( mirror://sourceforge/webadmin/${P}.tar.gz )"
13
14 LICENSE="BSD GPL-2"
15 SLOT="0"
16
17 KEYWORDS="~amd64 ~x86"
18
19 # NOTE: The ssl flag auto added by ssl-cert eclass is not used actually
20 # because openssl is forced by dev-perl/Net-SSLeay
21 IUSE="minimal +ssl mysql postgres ldap"
22
23 # All the required perl modules can be found easily using (in Webmin's root src dir):
24 # find . -name cpan_modules.pl -exec grep "::" {} \;
25 # NOTE: If Webmin doesn't find the required perl modules, it offers(runtime) the user
26 # to install them using the in-built cpan module, and this will mess up perl on the system
27 # That's why some modules are forced without a use flag
28 # NOTE: pam and ssl deps are forced for security and Gentoo compliance installation reasons
29 DEPEND="virtual/perl-Sys-Syslog
30 virtual/perl-Time-HiRes
31 virtual/perl-Time-Local
32 dev-perl/Authen-Libwrap
33 dev-perl/IO-Tty
34 dev-perl/MD5
35 dev-perl/Net-SSLeay
36 dev-perl/Authen-PAM
37 dev-perl/Sys-Hostname-Long
38 !minimal? (
39 mysql? ( dev-perl/DBD-mysql )
40 postgres? ( dev-perl/DBD-Pg )
41 ldap? ( dev-perl/perl-ldap )
42 dev-perl/XML-Generator
43 dev-perl/XML-Parser
44 )"
45 RDEPEND="${DEPEND}"
46
47 src_prepare() {
48 local perl="$( which perl )"
49
50 # Remove the unnecessary and incompatible files
51 rm -rf acl/Authen-SolarisRBAC-0.1*
52 if ! use minimal ; then
53 rm -rf {format,{bsd,hpux,sgi}exports,zones,rbac}
54 rm -f mount/{free,net,open}bsd-mounts*
55 rm -f mount/macos-mounts*
56 fi
57
58 # For security reasons remove the SSL certificate that comes with Webmin
59 # We will create our own later
60 rm -f miniserv.pem
61
62 # Remove the Webmin setup scripts to avoid Webmin in runtime to mess up config
63 # We will use our own later
64 rm -f setup.{sh,pl}
65
66 # Fix the permissions of the install files
67 chmod -R og-w "${S}"
68
69 # Since we should not modify any files after install
70 # we set the perl path in all cgi and pl files here using Webmin's routines
71 # The pl file is Prefix safe and works only on provided input, no other filesystem files
72 ebegin "Fixing perl path in source files"
73 (find "${S}" -name '*.cgi' -print ; find "${S}" -name '*.pl' -print) | $perl "${S}"/perlpath.pl $perl -
74 eend $?
75 }
76
77 src_install() {
78 # Create config dir and keep
79 diropts -m0755
80 dodir /etc/webmin
81 keepdir /etc/webmin
82
83 # Create install dir
84 # Third party modules installed through Webmin go here too, so keep
85 dodir /usr/libexec/webmin
86 keepdir /usr/libexec/webmin
87
88 # Copy our own setup script to installation folder
89 insinto /usr/libexec/webmin
90 newins "${FILESDIR}"/gentoo-setup gentoo-setup.sh
91 fperms 0744 /usr/libexec/webmin/gentoo-setup.sh
92
93 # This is here if we ever want in future ebuilds to add some specific
94 # config values in the /etc/webmin/miniserv.conf
95 # The format of this file should be the same as the one of miniserv.conf:
96 # var=value
97 #
98 # Uncomment it if you use such file. Before that check if upstream
99 # has this file in root dir too.
100 #newins "${FILESDIR}/miniserv-conf" miniserv-conf
101
102 # Create the log dir and keep
103 diropts -m0700
104 dodir /var/log/webmin
105 keepdir /var/log/webmin
106
107 # Create the init.d file and put the neccessary variables there
108 newinitd "${FILESDIR}"/init.d.webmin webmin
109 sed -i \
110 -e "s:%exe%:${EROOT}usr/libexec/webmin/miniserv.pl:" \
111 -e "s:%pid%:${EROOT}var/run/webmin.pid:" \
112 -e "s:%conf%:${EROOT}etc/webmin/miniserv.conf:" \
113 -e "s:%perllib%:${EROOT}usr/libexec/webmin:" \
114 "${ED}etc/init.d/webmin" \
115 || die "Failed to patch the webmin init file"
116
117 # Setup pam
118 pamd_mimic system-auth webmin auth account session
119
120 # Copy files to installation folder
121 ebegin "Copying install files to destination"
122 cp -pPR "${S}"/* "${ED}usr/libexec/webmin"
123 eend $?
124 }
125
126 pkg_preinst() {
127 # First stop service if running so Webmin to not messup our config
128 ebegin "Stopping any running Webmin instance prior merging"
129 rc-service --ifexists -- webmin --ifstarted stop
130 eend $?
131 }
132
133 pkg_postinst() {
134 # Run pkg_config phase first - non interactively
135 export INTERACTIVE="no"
136 pkg_config
137 # Every next time pkg_config should be interactive
138 INTERACTIVE="yes"
139
140 ewarn
141 ewarn "Bare in mind that not all Webmin modules are Gentoo tweaked and may have some issues."
142 ewarn "Always be careful when using modules that modify init entries, do update of webmin, install CPAN modules etc."
143 ewarn "To avoid problems, please before using any module, look at its configuration options first."
144 ewarn "(Usually there is a link at top in the right pane of Webmin for configuring the module.)"
145 ewarn
146 elog "- To make Webmin start at boot time, run: 'rc-update add webmin default'"
147 elog "- The default URL to connect to Webmin is: https://localhost:10000"
148 elog "- The default user that can login is: root"
149 elog "- To reconfigure Webmin in case of problems run 'emerge --config app-admin/webmin'"
150 }
151
152 pkg_prerm() {
153 # First stop service if running - we do not want Webmin to mess up config
154 ebegin "Stopping any running Webmin instance prior unmerging"
155 rc-service --ifexists -- webmin --ifstarted stop
156 eend $?
157 }
158
159 pkg_postrm() {
160 ewarn
161 ewarn "You have uninstalled Webmin, so have in mind that all cron jobs scheduled"
162 ewarn "by Webmin for its own modules, are left active and they will fail when Webmin is missing."
163 ewarn "To fix this just disable them if you intend to use Webmin again,"
164 ewarn "OR delete them if not."
165 ewarn
166 }
167
168 pkg_config(){
169 # First stop service if running
170 ebegin "Stopping any running Webmin instance"
171 rc-service --ifexists -- webmin --ifstarted stop
172 eend $?
173
174 # Next set the default reset variable to 'none'
175 # reset/_reset can be:
176 # 'none' - does not reset anything, just upgrades if a conf is present
177 # OR installs new conf if a conf is missing
178 # 'soft' - deletes only $config_dir/config file and thus resetting most
179 # conf values to their defaults. Keeps the specific Webmin cron jobs
180 # 'hard' - deletes all files in $config_dir (keeping the .keep_* Gentoo file)
181 # and thus resetting all Webmin. Deletes the specific Webmin cron jobs too.
182 local _reset="none"
183
184 # If in interactive mode ask user what should we do
185 if [[ "${INTERACTIVE}" = "yes" ]]; then
186 einfo
187 einfo "Please enter the number of the action you would like to perform?"
188 einfo
189 einfo "1. Update configuration"
190 einfo " (keeps old config options and adds the new ones)"
191 einfo "2. Soft reset configuration"
192 einfo " (keeps some old config options, the other options are set to default)"
193 ewarn " All Webmin users will be reset"
194 einfo "3. Hard reset configuration"
195 einfo " (all options including module options are set to default)"
196 ewarn " You will lose all Webmin configuration options you have done till now"
197 einfo "4. Exit this configuration utility (default)"
198 while [ "$correct" != "true" ] ; do
199 read answer
200 if [[ "$answer" = "1" ]] ; then
201 _reset="none"
202 correct="true"
203 elif [[ "$answer" = "2" ]] ; then
204 _reset="soft"
205 correct="true"
206 elif [[ "$answer" = "3" ]] ; then
207 _reset="hard"
208 correct="true"
209 elif [ "$answer" = "4" -o "$answer" = "" ] ; then
210 die "User aborted configuration."
211 else
212 echo "Answer not recognized. Enter a number from 1 to 4"
213 fi
214 done
215
216 if [[ "$_reset" = "hard" ]]; then
217 while [ "$sure" != "true" ] ; do
218 ewarn "You will lose all Webmin configuration options you have done till now."
219 ewarn "Are you sure you want to do this? (y/n)"
220 read answer
221 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
222 sure="true"
223 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
224 die "User aborted configuration."
225 else
226 echo "Answer not recognized. Enter 'y' or 'n'"
227 fi
228 done
229 fi
230 fi
231
232 export reset=$_reset
233
234 # Create ssl certificate for Webmin if there is not one in the proper place
235 if [[ ! -e "${EROOT}etc/ssl/webmin/server.pem" ]]; then
236 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Webmin Server}"
237 SSL_COMMONNAME="${SSL_COMMONNAME:-*}"
238 install_cert "${EROOT}/etc/ssl/webmin/server"
239 fi
240
241 # Ensure all paths passed to the setup script use EROOT
242 export wadir="${EROOT}usr/libexec/webmin"
243 export config_dir="${EROOT}etc/webmin"
244 export var_dir="${EROOT}var/log/webmin"
245 export tempdir="${T}"
246 export pidfile="${EROOT}var/run/webmin.pid"
247 export perl="$( which perl )"
248 export os_type='gentoo-linux'
249 export os_version='*'
250 export real_os_type='Gentoo Linux'
251 export real_os_version='Any version'
252 # Forcing 'ssl' and 'ssl_redirect' for tightening security
253 export ssl=1
254 export ssl_redirect=1
255 export keyfile="${EROOT}etc/ssl/webmin/server.pem"
256 export port=10000
257
258 export atboot=0
259
260 einfo "Executing Webmin's configure script"
261 $wadir/gentoo-setup.sh
262
263 einfo "Configuration of Webmin done"
264 }

  ViewVC Help
Powered by ViewVC 1.1.20