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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Nov 7 18:51:57 2012 UTC (2 years, 8 months ago) by hwoarang
Branch: MAIN
Changes since 1.1: +3 -3 lines
The SA51201 patch does need to apply in the minimal version

(Portage version: 2.1.11.31/cvs/Linux x86_64, signed Manifest commit with key B4AFF2C2)

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

  ViewVC Help
Powered by ViewVC 1.1.20