File webif.spec of Package webif
#
# spec file for package webif (Version 0.3-8)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: webif
Version: 0.3.8
%define ipkver 0.3-8
Release: 8
#BuildRequires: dos2unix haserl
BuildRequires: dos2unix
#Requires: haserl
URL: http://x-wrt.org/
Source: %{name}-%{version}.tar.gz
Source2: README
Patch1: bstrip-includes.diff
Patch2: webif-Makefile.diff
Patch3: webif-page-lang-path.diff
Source5: ftp://ftp.berlios.de/pub/xwrt/packages/%{name}_%{ipkver}_mipsel.ipk
Patch6: paths.diff
Patch7: webif-fixes.diff
Patch8: webif-suse.diff
Patch9: webif-yast.diff
Patch10: webif-diskgraph.diff
Source10: %{name}-lang-de_%{ipkver}_mipsel.ipk
Source11: %{name}-lang-es_%{ipkver}_mipsel.ipk
Source12: %{name}-lang-fr_%{ipkver}_mipsel.ipk
Source13: %{name}-lang-it_%{ipkver}_mipsel.ipk
Source14: %{name}-lang-nl_%{ipkver}_mipsel.ipk
Source15: %{name}-lang-hu_%{ipkver}_mipsel.ipk
Source16: %{name}-lang-sv_%{ipkver}_mipsel.ipk
Source17: %{name}-lang-ru_%{ipkver}_mipsel.ipk
Source18: %{name}-lang-cs_%{ipkver}_mipsel.ipk
Source19: %{name}-lang-pt_%{ipkver}_mipsel.ipk
Source20: %{name}-lang-pl_%{ipkver}_mipsel.ipk
Source21: %{name}-lang-no_%{ipkver}_mipsel.ipk
Source22: %{name}-lang-zh_%{ipkver}_mipsel.ipk
Source23: %{name}-lang-uk_%{ipkver}_mipsel.ipk
Source24: %{name}-lang-ca_%{ipkver}_mipsel.ipk
Source25: %{name}-lang-hr_%{ipkver}_mipsel.ipk
Source26: %{name}-lang-he_%{ipkver}_mipsel.ipk
Source27: %{name}-lang-ee_%{ipkver}_mipsel.ipk
Source28: %{name}-lang-da_%{ipkver}_mipsel.ipk
Source40: %{name}-theme-xwrt_%{ipkver}_mipsel.ipk
Source41: %{name}-theme-zephyr_%{ipkver}_mipsel.ipk
Source60: %{name}-yast.tar.gz
License: GNU General Public License v2 (GPLv2)
Summary: Web Interface script collection (using haserl)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Group: Development/Tools/GUI Builders
%description
webif is a framework to build a web management console using
an additional wrapper around haserl to host shell scripts.
collection of shell scripts
This package is derived from webif2 in X-WRT.
%prep
%setup -n webif
%patch1 -p1
%patch2 -p1
%patch3 -p1
cd ..
for name in $RPM_SOURCE_DIR/*.ipk; do
nm=${name%%_mipsel.ipk}
nm=${nm##*/}
mkdir $nm
cd $nm
tar xvzf $name
tar xvzf data.tar.gz
tar xvzf control.tar.gz
if test $nm = %{name}_%{ipkver}; then
patch -p1 <%{PATCH6}
patch -p1 <%{PATCH7}
patch -p1 <%{PATCH8}
patch -p1 <%{PATCH9}
patch -p1 <%{PATCH10}
chmod +x www/cgi-bin/webif/graph*.sh
mac2unix www/js/styleswitcher.js
chmod -x www/cgi-bin/webif/.categories
fi
cd ..
done
#autoreconf -fi
cp -p %{SOURCE2} .
%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
%install
make install DESTDIR=$RPM_BUILD_ROOT
# TODO:
# Install /usr/lib/webif
# Install www -> /usr/share/webif/www
# Install /bin,/usr/bin -> /usr/lib/webif
# Install /lib/config -> /usr/lib/webif
# Install /etc/config -> /etc/webif
cd ..
mkdir -p $RPM_BUILD_ROOT/etc/webif
mkdir -p $RPM_BUILD_ROOT/usr/share/webif/www
mkdir -p $RPM_BUILD_ROOT/usr/lib/webif
cd %{name}_%{ipkver}
rm usr/bin/webifmetabin
for name in `find etc usr lib www bin sbin`; do
unset nname
case $name in
www/*)
nname=/usr/share/webif/$name
;;
usr/lib/webif/*)
nname=$name
;;
usr/bin/*|usr/sbin/*|bin/*|sbin/*)
nname=/usr/lib/webif/bin/${name##*/}
;;
etc/config/*)
nname=/etc/webif/${name##*/}
;;
lib/config/*|etc/funct*)
nname=/usr/lib/webif/config/${name##*/}
;;
*)
echo "Drop file $name"
;;
esac
if test -z "$nname"; then continue; fi
if test -d $name; then mkdir -p $RPM_BUILD_ROOT/$nname;
else
dir=$RPM_BUILD_ROOT/${nname%/*}
if test ! -d $dir; then mkdir -p $dir; fi
cp $name $RPM_BUILD_ROOT/$nname
case $name in
www/cgi-bin/*) ;;
www/*|etc/config/*) chmod -x $RPM_BUILD_ROOT/$nname ;;
*) ;;
esac
fi
done
cd ..
# Process webif-themes files
for dir in webif-theme*; do
cd $dir
for nm in `find www`; do
if test -d $nm; then mkdir -p $RPM_BUILD_ROOT/usr/share/webif/$nm;
else
ddir=$RPM_BUILD_ROOT/usr/share/webif/${nm%/*}
if test ! -d $ddir; then mkdir -p $ddir; fi
cp -p $nm $ddir/
case $nm in www/cgi-bin/*) ;; *) chmod -x $ddir/${nm##*/}; esac
fi
done
cd ..
done
# Tweak xwrt theme
sed -i 's!^#header h1 { display: none; }!/* header h1 { display: none; } */!' \
$RPM_BUILD_ROOT/usr/share/webif/www/themes/xwrt/webif.css
# Process webif-lang files
for dir in webif-lang*; do
cd $dir
for nm in `find usr`; do
if test -d $nm; then mkdir -p $RPM_BUILD_ROOT/$nm;
else
ddir=$RPM_BUILD_ROOT/${nm%/*}
if test ! -d $ddir; then mkdir -p $ddir; fi
cp -p $nm $ddir/
chmod -x $ddir/${nm##*/}
#case $nm in www/cgi-bin/*) ;; *) chmod -x $ddir/${nm##*/}; esac
fi
done
cd ..
done
tar xvz -C $RPM_BUILD_ROOT -f %{SOURCE60}
# TODO:
# Need to do adaptions in files ...
# currently realized as patch
# Do collect themes, languages
# can be done at run time
# Activate theme via active symlink
mkdir -p $RPM_BUILD_ROOT/var/lib/webif
ln -s /usr/share/webif/www/themes/xwrt $RPM_BUILD_ROOT/var/lib/webif/activetheme
ln -s /var/lib/webif/activetheme $RPM_BUILD_ROOT/usr/share/webif/www/themes/active
# TOOD: Switching can't be done via switching symlinks in /usr!
%files
%defattr(-,root,root)
/usr/bin/webifmetabin
/usr/bin/webif-page
/usr/bin/bstrip
/usr/bin/int2human
/usr/bin/wepkeygen
%doc ../README
%dir /usr/lib/webif
/usr/lib/webif/*
%dir /usr/share/webif
/usr/share/webif/*
%dir /etc/webif
%config /etc/webif/*
%dir /var/lib/webif
/var/lib/webif/activetheme