1 |
%define rname phpMyAdmin |
2 |
|
3 |
Summary: Handles the administration of MySQL over the web |
4 |
Name: phpmyadmin |
5 |
Version: 3.4.7.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 |
rm -rf %{buildroot} |
36 |
|
37 |
export DONT_RELINK=1 |
38 |
|
39 |
install -d %{buildroot}%{_sysconfdir}/%{name} |
40 |
install -d %{buildroot}%{_datadir}/%{name} |
41 |
|
42 |
cp -aRf * %{buildroot}%{_datadir}/%{name}/ |
43 |
|
44 |
# cleanup |
45 |
pushd %{buildroot}%{_datadir}/%{name} |
46 |
rm -f CREDITS ChangeLog Documentation.txt INSTALL LICENSE README |
47 |
rm -f README.VENDOR RELEASE-DATE-* TODO |
48 |
rm -rf scripts |
49 |
rm -rf contrib |
50 |
rm -f lang/*.sh libraries/transformations/*.sh |
51 |
find -name "\.htaccess" | xargs rm -f |
52 |
popd |
53 |
|
54 |
# fix config file location |
55 |
mv %{buildroot}%{_datadir}/%{name}/config.sample.inc.php \ |
56 |
%{buildroot}%{_sysconfdir}/%{name}/config.php |
57 |
|
58 |
pushd %{buildroot}%{_datadir}/%{name} |
59 |
ln -s %{_sysconfdir}/%{name}/config.php config.inc.php |
60 |
popd |
61 |
chmod 640 %{buildroot}%{_sysconfdir}/%{name}/config.php |
62 |
|
63 |
cat > README.urpmi << EOF |
64 |
The actual configuration file is /etc/phpmyadmin/config.php. |
65 |
The config.default.inc.php file contains default values, and is not supposed to |
66 |
be modified. |
67 |
EOF |
68 |
|
69 |
install -d -m 755 %{buildroot}%{webappconfdir} |
70 |
cat > %{buildroot}%{webappconfdir}/%{name}.conf << EOF |
71 |
Alias /%{name} %{_datadir}/%{name} |
72 |
|
73 |
<Directory %{_datadir}/%{name}> |
74 |
Order deny,allow |
75 |
Deny from all |
76 |
Allow from 127.0.0.1 |
77 |
ErrorDocument 403 "Access denied per %{webappconfdir}/%{name}.conf" |
78 |
|
79 |
php_flag session.auto_start 0 |
80 |
</Directory> |
81 |
|
82 |
<Directory %{_datadir}/%{name}/libraries> |
83 |
Order deny,allow |
84 |
Deny from all |
85 |
</Directory> |
86 |
EOF |
87 |
|
88 |
# new Icons |
89 |
install -d %{buildroot}%{_iconsdir} |
90 |
install -d %{buildroot}%{_miconsdir} |
91 |
install -d %{buildroot}%{_liconsdir} |
92 |
|
93 |
install -m0644 %{SOURCE1} %{buildroot}%{_miconsdir}/%{name}.png |
94 |
install -m0644 %{SOURCE2} %{buildroot}%{_iconsdir}/%{name}.png |
95 |
install -m0644 %{SOURCE3} %{buildroot}%{_liconsdir}/%{name}.png |
96 |
|
97 |
# install menu entry. |
98 |
# XDG menu |
99 |
install -d %{buildroot}%{_datadir}/applications |
100 |
cat > %{buildroot}%{_datadir}/applications/%{_real_vendor}-%{name}.desktop << EOF |
101 |
[Desktop Entry] |
102 |
Name=phpMyAdmin |
103 |
Comment=%{summary} |
104 |
Exec=%{_bindir}/www-browser http://localhost/%{name}/ |
105 |
Icon=%{name} |
106 |
Terminal=false |
107 |
Type=Application |
108 |
Categories=X-MandrivaLinux-MoreApplications-Databases; |
109 |
EOF |
110 |
|
111 |
# fix borked permissions |
112 |
find %{buildroot}%{_datadir}/%{name} -type d -exec chmod 755 {} \; |
113 |
find %{buildroot}%{_datadir}/%{name} -type f -exec chmod 644 {} \; |
114 |
|
115 |
%pretrans |
116 |
# fix configuration file name change |
117 |
if [ -f %{_sysconfdir}/phpmyadmin/config.default.php ]; then |
118 |
mv %{_sysconfdir}/phpmyadmin/config.default.php \ |
119 |
%{_sysconfdir}/phpmyadmin/config.php |
120 |
fi |
121 |
if [ -L /var/www/phpmyadmin/libraries/config.default.php ]; then |
122 |
rm -f /var/www/phpmyadmin/libraries/config.default.php |
123 |
fi |
124 |
if [ -L %{_datadir}/phpmyadmin/libraries/config.default.php ]; then |
125 |
rm -f %{_datadir}/phpmyadmin/libraries/config.default.php |
126 |
fi |
127 |
|
128 |
%post |
129 |
# generate random secret |
130 |
secret=%_get_password 46 |
131 |
|
132 |
# blowfish secret |
133 |
perl -pi \ |
134 |
-e "s|\\\$cfg\\['blowfish_secret'\\] = ''|\\\$cfg\\['blowfish_secret'\\] = '$secret'|" \ |
135 |
%{_sysconfdir}/%{name}/config.php |
136 |
|
137 |
%clean |
138 |
rm -rf %{buildroot} |
139 |
|
140 |
%files |
141 |
%defattr(-,root,root) |
142 |
%doc CREDITS ChangeLog Documentation.txt INSTALL LICENSE README RELEASE-DATE-* TODO scripts README.urpmi |
143 |
%config(noreplace) %{webappconfdir}/%{name}.conf |
144 |
%dir %{_sysconfdir}/%{name} |
145 |
%attr(-,root,apache) %config(noreplace) %{_sysconfdir}/%{name}/config.php |
146 |
%{_datadir}/%{name} |
147 |
%{_iconsdir}/%{name}.png |
148 |
%{_miconsdir}/%{name}.png |
149 |
%{_liconsdir}/%{name}.png |
150 |
%{_datadir}/applications/*.desktop |
151 |
|
152 |
|