summaryrefslogtreecommitdiff
path: root/extra/webmin/PKGBUILD
blob: 94fbb3a7e85561afb6151a47f51454db971e06a3 (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# $Id: PKGBUILD 167305 2012-09-30 19:42:57Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
pkgname=webmin
pkgver=1.600
pkgrel=1
pkgdesc="a web-based interface for system administration"
arch=(i686 x86_64 'mips64el')
license=('custom:webmin')
url="http://www.webmin.com/"
depends=('perl' 'perl-perl4-corelibs')
makedepends=('perl-net-ssleay')
backup=('etc/webmin/miniserv.conf' 'etc/webmin/miniserv.users' 'etc/webmin/config' 'etc/webmin/webmin.cats' \
'etc/webmin/pacman/config' \
'etc/webmin/at/config' \
'etc/webmin/acl/config' \
'etc/webmin/lvm/config' \
'etc/webmin/net/config' \
'etc/webmin/nis/config' \
'etc/webmin/pam/config' \
'etc/webmin/cron/config' \
'etc/webmin/file/config' \
'etc/webmin/grub/config' \
'etc/webmin/init/config' \
'etc/webmin/ipfw/config' \
'etc/webmin/lilo/config' \
'etc/webmin/proc/config' \
'etc/webmin/raid/config' \
'etc/webmin/spam/config' \
'etc/webmin/sshd/config' \
'etc/webmin/time/config' \
'etc/webmin/cluster-passwd/config' \
'etc/webmin/software/config' \
'etc/webmin/webminlog/config' \
'etc/webmin/cluster-webmin/config' \
'etc/webmin/bind8/config' \
'etc/webmin/dhcpd/config' \
'etc/webmin/fdisk/config' \
'etc/webmin/mount/config' \
'etc/webmin/mysql/config' \
'etc/webmin/quota/config' \
'etc/webmin/samba/config' \
'etc/webmin/shell/config' \
'etc/webmin/squid/config' \
'etc/webmin/adsl-client/config' \
'etc/webmin/servers/config' \
'etc/webmin/cluster-shell/config' \
'etc/webmin/bandwidth/config' \
'etc/webmin/ppp-client/config' \
'etc/webmin/lpadmin/config' \
'etc/webmin/apache/config' \
'etc/webmin/firewall/config' \
'etc/webmin/stunnel/config' \
'etc/webmin/burner/config' \
'etc/webmin/exports/config' \
'etc/webmin/backup-config/config' \
'etc/webmin/custom/config' \
'etc/webmin/htaccess-htpasswd/config' \
'etc/webmin/logrotate/config' \
'etc/webmin/format/config' \
'etc/webmin/fsdump/config' \
'etc/webmin/passwd/config' \
'etc/webmin/cluster-useradmin/config' \
'etc/webmin/cluster-software/config' \
'etc/webmin/cluster-copy/config' \
'etc/webmin/cluster-cron/config' \
'etc/webmin/telnet/config' \
'etc/webmin/status/config' \
'etc/webmin/syslog/config' \
'etc/webmin/updown/config' \
'etc/webmin/usermin/config' \
'etc/webmin/webmin/config' \
'etc/webmin/xinetd/config' \
'etc/webmin/openslp/config' \
'etc/webmin/procmail/config' \
'etc/webmin/fetchmail/config' \
'etc/webmin/postgresql/config' \
'etc/webmin/useradmin/config' \
'etc/webmin/mailboxes/config' \
'etc/webmin/inittab/config' \
'etc/webmin/change-user/config' \
'etc/webmin/postfix/config' \
'etc/webmin/proftpd/config' \
'etc/webmin/pserver/config' \
'etc/webmin/dnsadmin/config' )
install=webmin.install
source=(http://downloads.sourceforge.net/sourceforge/webadmin/$pkgname-$pkgver.tar.gz 
	ftp://ftp.archlinux.org/other/webmin/webmin-config.tar.bz2 
	ftp://ftp.archlinux.org/other/webmin/webmin-pacman.tar.bz2
	webmin.rc
	webmin.service) 
options=(!strip)

build() {
  # NOTE: USE --asroot build option to avoid fakeroot error!
  cd $startdir/src/$pkgname-$pkgver
  # add patches from webmin.com
  #for i in ../*.wbm 
  #do tar xvf $i
  #done
  #for i in ../*.wbt
  #do tar xvf $i
  #done
  # delete stuff that's not needed
  rm -f mount/freebsd-mounts*
  rm -f mount/openbsd-mounts*
  rm -f mount/macos-mounts*
  
  # remove modules we do not support
  rm -rf {bacula-backup,ldap-useradmin,mon,sentry,frox,jabber,majordomo,qmail,sendmail,sarg,wuftpd,webalizer,inetd,ipsec,pap,pptp-client,pptp-server,shorewall,smart-status,vgetty,heartbeat,cfengine,cpan,sgiexports,hpuxexports,qmailadmin,bsdexports,dfsadmin}
  
  #remove config files from other distros
  rm -f $(find . ! -name 'config-generic-linux' ! -name 'config-\*-linux' ! -name 'config-lib.pl' -name 'config-*')
  
  # remove caldera theme
  rm -rf caldera

  # remove init-scripts from other distros
  rm webmin-gentoo-init
  rm webmin-init
  rm webmin-caldera-init
  rm webmin-daemon

  # remove update stuff to avoid problems with updating webmin,modules and themes without pacman
  rm -f webmin/{update.cgi,update.pl,update_sched.cgi,upgrade.cgi,edit_upgrade.cgi,install_mod.cgi,delete_mod.cgi,install_theme.cgi}
  rm -f usermin/{upgrade.cgi,update.cgi,update.pl,edit_upgrade.cgi,install_mod.cgi,delete_mod.cgi,install_theme.cgi}

  # remove modules add because we don't want files installed without pacman control
  rm -f webmin/{install_mod.cgi,delete_mod.cgi}  

  # setting perl path
  (find . -name '*.cgi' ; find . -name '*.pl') | perl perlpath.pl /usr/bin/perl -
  
  # create dirs
  mkdir -p $startdir/pkg/opt/webmin
  mkdir -p $startdir/pkg/var/log/webmin
  mkdir -p $startdir/pkg/etc/webmin
  
  # install pam stuff
  install -D -m 644 webmin-pam $startdir/pkg/etc/pam.d/webmin
  
  # remove other distros and add only Archlinux don't change next line else it will not work!
  rm os_list.txt
  echo 'Archlinux			Any version	generic-linux	*	-d "/etc/pacman.d"' >> os_list.txt
  
  # Add rc.conf support to boot and shutdown menu and lock editing of this module
  cd init/
  sed -i -e 's:^local_down=.*:local_down=Archlinux RC.CONF,3,None:g' $(find . ! -name 'config.info.pl' -name 'config.info*')
  sed -i -e 's:^local_script=.*:local_script=Archlinux RC.LOCAL,3,None:g' $(find . ! -name 'config.info.pl' -name 'config.info*') 
  sed -i -e 's:^index_downscript=.*:index_downscript=Archlinux RC.CONF:g' lang/*
  sed -i -e 's:^index_script=.*:index_script=Archlinux RC.LOCAL:g' lang/*
  sed -i -e 's:^noconfig=0:noconfig=1:g'  defaultacl

  # Add pacman menu
  cd $startdir/src/$pkgname-$pkgver
  cp -rf custom/ pacman
  cp -rf mscstyle3/custom mscstyle3/pacman
  sed -i -e 's:^noconfig=0:noconfig=1:g' -e 's:^edit=1:edit=0:g' pacman/defaultacl
  sed -i -e '/desc/d' -e '/longdesc/d' pacman/module.info
  sed -i -e 's:^name=Custom:name=Pacman:g' pacman/module.info
  echo 'category=system' >> pacman/module.info
  echo 'desc=Pacman' >> pacman/module.info
  sed -i -e 's:^index_title=.*:index_title=Pacman:g' pacman/lang/*

  # copy stuff to right dirs
  cd $startdir/src/$pkgname-$pkgver
  cp -rp * $startdir/pkg/opt/webmin
  cd $startdir/src/webmin-config
  cp -rfp * $startdir/pkg/opt/webmin

  # define parameters for setup.sh
  config_dir=$startdir/pkg/etc/webmin
  var_dir=$startdir/pkg/var/log/webmin
  perl=/usr/bin/perl
  autoos=1
  port=10000
  login=root
  crypt="XXX"
  ssl=1
  atboot=0
  nostart=1
  nochown=1
  autothird=1
  nouninstall=1
  noperlpath=1
  atbootyn=n
  tempdir=$startdir/pkg/tmp
  export config_dir var_dir perl autoos port tempdir login crypt ssl nochown autothird nouninstall nostart noperlpath atbootyn
  
  # Fix setup.sh
  sed -i -e 's:read atbootyn::g' -e 's:exit 13::g' $startdir/pkg/opt/webmin/setup.sh
  $startdir/pkg/opt/webmin/setup.sh
  
  # Fixup the config files to use their real locations
  sed -i 's:^pidfile=.*$:pidfile=/var/run/webmin.pid:' $startdir/pkg/etc/webmin/miniserv.conf
  find $startdir/pkg/etc/webmin -type f -exec sed -i "s:$startdir/pkg::g" {} \; 
  
  # make it only accessible by localhost
  echo 'allow=127.0.0.1' >> $startdir/pkg/etc/webmin/miniserv.conf
  
  # install pacman menu
  cd $startdir/src/webmin-pacman/config
  cp -rfp * $startdir/pkg/etc/webmin/pacman

  #install rc file
  install -D -m 755 $startdir/src/webmin.rc $startdir/pkg/etc/rc.d/webmin

  # install systemd files
  install -D -m 644 $srcdir/webmin.service $pkgdir/usr/lib/systemd/system/webmin.service

  # delete temp dir
  rm -r $startdir/pkg/tmp
  # change sticky bit
  chmod 0644 $pkgdir/opt/webmin/man/config-generic-linux
  # install license
  install -m 644 -D $startdir/src/$pkgname-$pkgver/LICENCE $startdir/pkg/usr/share/licenses/webmin/LICENCE
}
md5sums=('8a9124bdd180aeec13fc16fa75fb1419'
         '43a77243acd519c4efe9577090b59912'
         'bfebb75bb94029b48c46b7f1ba1aa811'
         'c77dfcd621b417a7826d25f56a1e60ae'
         'fc29ecb6a5cd8c278abe054e60381095')