1 |
%define rname phpMyAdmin |
2 |
|
3 |
Summary: Handles the administration of MySQL over the web |
4 |
Name: phpmyadmin |
5 |
Version: 3.5.1 |
6 |
Release: %mkrel 1 |
7 |
License: GPLv2 |
8 |
Group: System/Servers |
9 |
URL: http://www.phpmyadmin.net/ |
10 |
Source0: http://prdownloads.sourceforge.net/phpmyadmin/%{rname}-%{version}-all-languages.tar.xz |
11 |
Source1: phpmyadmin-16x16.png |
12 |
Source2: phpmyadmin-32x32.png |
13 |
Source3: phpmyadmin-48x48.png |
14 |
Requires: apache-mod_php |
15 |
Requires: php-mysql |
16 |
Requires: php-mbstring |
17 |
Requires: php-mcrypt |
18 |
BuildArch: noarch |
19 |
Obsoletes: phpMyAdmin |
20 |
|
21 |
%description |
22 |
phpMyAdmin is intended to handle the administration of MySQL over the web. |
23 |
Currently it can : create and drop databases, create, copy, drop and alter |
24 |
tables, delete, edit and add fields, execute any SQL-statement, even |
25 |
batch-queries, manage keys on fields, load text files into tables, create and |
26 |
read dumps of tables, export data to CSV value, administer multiple servers |
27 |
and single databases. |
28 |
|
29 |
%prep |
30 |
%setup -q -n %{rname}-%{version}-all-languages |
31 |
|
32 |
%build |
33 |
|
34 |
%install |
35 |
export DONT_RELINK=1 |
36 |
|
37 |
install -d %{buildroot}%{_sysconfdir}/%{name} |
38 |
install -d %{buildroot}%{_datadir}/%{name} |
39 |
|
40 |
cp -aRf * %{buildroot}%{_datadir}/%{name}/ |
41 |
|
42 |
# cleanup |
43 |
pushd %{buildroot}%{_datadir}/%{name} |
44 |
rm -f CREDITS ChangeLog Documentation.txt INSTALL LICENSE README |
45 |
rm -f README.VENDOR RELEASE-DATE-* TODO |
46 |
rm -rf scripts |
47 |
rm -rf contrib |
48 |
rm -f lang/*.sh libraries/transformations/*.sh |
49 |
find -name "\.htaccess" | xargs rm -f |
50 |
popd |
51 |
|
52 |
# fix config file location |
53 |
mv %{buildroot}%{_datadir}/%{name}/config.sample.inc.php \ |
54 |
%{buildroot}%{_sysconfdir}/%{name}/config.php |
55 |
|
56 |
pushd %{buildroot}%{_datadir}/%{name} |
57 |
ln -s %{_sysconfdir}/%{name}/config.php config.inc.php |
58 |
popd |
59 |
chmod 640 %{buildroot}%{_sysconfdir}/%{name}/config.php |
60 |
|
61 |
cat > README.urpmi << EOF |
62 |
The actual configuration file is /etc/phpmyadmin/config.php. |
63 |
The config.default.inc.php file contains default values, and is not supposed to |
64 |
be modified. |
65 |
EOF |
66 |
|
67 |
install -d -m 755 %{buildroot}%{webappconfdir} |
68 |
cat > %{buildroot}%{webappconfdir}/%{name}.conf << EOF |
69 |
Alias /%{name} %{_datadir}/%{name} |
70 |
|
71 |
<Directory %{_datadir}/%{name}> |
72 |
Order deny,allow |
73 |
Deny from all |
74 |
Allow from 127.0.0.1 |
75 |
ErrorDocument 403 "Access denied per %{webappconfdir}/%{name}.conf" |
76 |
|
77 |
php_flag session.auto_start 0 |
78 |
</Directory> |
79 |
|
80 |
<Directory %{_datadir}/%{name}/libraries> |
81 |
Order deny,allow |
82 |
Deny from all |
83 |
</Directory> |
84 |
EOF |
85 |
|
86 |
# new Icons |
87 |
install -d %{buildroot}%{_iconsdir} |
88 |
install -d %{buildroot}%{_miconsdir} |
89 |
install -d %{buildroot}%{_liconsdir} |
90 |
|
91 |
install -m0644 %{SOURCE1} %{buildroot}%{_miconsdir}/%{name}.png |
92 |
install -m0644 %{SOURCE2} %{buildroot}%{_iconsdir}/%{name}.png |
93 |
install -m0644 %{SOURCE3} %{buildroot}%{_liconsdir}/%{name}.png |
94 |
|
95 |
# install menu entry. |
96 |
# XDG menu |
97 |
install -d %{buildroot}%{_datadir}/applications |
98 |
cat > %{buildroot}%{_datadir}/applications/%{_real_vendor}-%{name}.desktop << EOF |
99 |
[Desktop Entry] |
100 |
Name=phpMyAdmin |
101 |
Comment=%{summary} |
102 |
Exec=%{_bindir}/www-browser http://localhost/%{name}/ |
103 |
Icon=%{name} |
104 |
Terminal=false |
105 |
Type=Application |
106 |
Categories=X-MandrivaLinux-MoreApplications-Databases; |
107 |
EOF |
108 |
|
109 |
# fix borked permissions |
110 |
find %{buildroot}%{_datadir}/%{name} -type d -exec chmod 755 {} \; |
111 |
find %{buildroot}%{_datadir}/%{name} -type f -exec chmod 644 {} \; |
112 |
|
113 |
%pretrans |
114 |
# fix configuration file name change |
115 |
if [ -f %{_sysconfdir}/phpmyadmin/config.default.php ]; then |
116 |
mv %{_sysconfdir}/phpmyadmin/config.default.php \ |
117 |
%{_sysconfdir}/phpmyadmin/config.php |
118 |
fi |
119 |
if [ -L /var/www/phpmyadmin/libraries/config.default.php ]; then |
120 |
rm -f /var/www/phpmyadmin/libraries/config.default.php |
121 |
fi |
122 |
if [ -L %{_datadir}/phpmyadmin/libraries/config.default.php ]; then |
123 |
rm -f %{_datadir}/phpmyadmin/libraries/config.default.php |
124 |
fi |
125 |
|
126 |
%post |
127 |
# generate random secret |
128 |
secret=%_get_password 46 |
129 |
|
130 |
# blowfish secret |
131 |
perl -pi \ |
132 |
-e "s|\\\$cfg\\['blowfish_secret'\\] = ''|\\\$cfg\\['blowfish_secret'\\] = '$secret'|" \ |
133 |
%{_sysconfdir}/%{name}/config.php |
134 |
|
135 |
%clean |
136 |
|
137 |
%files |
138 |
%defattr(-,root,root) |
139 |
%doc ChangeLog Documentation.txt LICENSE README RELEASE-DATE-* README.urpmi |
140 |
%config(noreplace) %{webappconfdir}/%{name}.conf |
141 |
%dir %{_sysconfdir}/%{name} |
142 |
%attr(-,root,apache) %config(noreplace) %{_sysconfdir}/%{name}/config.php |
143 |
%{_datadir}/%{name} |
144 |
%{_iconsdir}/%{name}.png |
145 |
%{_miconsdir}/%{name}.png |
146 |
%{_liconsdir}/%{name}.png |
147 |
%{_datadir}/applications/*.desktop |
148 |
|
149 |
|