Commit 91901806 authored by Vitaly Lipatov's avatar Vitaly Lipatov

move etercifs.conf to /etc/sysconfig

move package parameters to /usr/share/etercifs/package.conf rewrite config load code
parent baf0fb4b
...@@ -19,9 +19,12 @@ ...@@ -19,9 +19,12 @@
%define src_2_6_31_version 1.60 %define src_2_6_31_version 1.60
%define src_2_6_32_version 1.61 %define src_2_6_32_version 1.61
# TODO: moved to rpm-build-altlinux-compat
%define _sysconfigdir %_sysconfdir/sysconfig
Name: etercifs Name: etercifs
Version: 4.4.5 Version: 4.4.5
Release: alt1 Release: alt2
Summary: Advanced Common Internet File System for Linux with Etersoft extension Summary: Advanced Common Internet File System for Linux with Etersoft extension
...@@ -99,29 +102,42 @@ though. ...@@ -99,29 +102,42 @@ though.
%setup %setup
%install %install
mkdir -p %buildroot%_sysconfdir/ mkdir -p %buildroot%_sysconfigdir
cat <<EOF >%buildroot%_sysconfdir/%name.conf cat <<EOF >%buildroot%_sysconfigdir/%name.conf
DATADIR=%_datadir/%name # etercifs configuration file
SRC_DIR=%_usrsrc/%name-%version
MODULENAME=%name
MODULEVERSION=%version
# this options useful only for wine share using and security=share setting in smb.conf # this options useful only for wine share using and security=share setting in smb.conf
MOUNT_OPTIONS=user=guest,pass=,rw,iocharset=utf8,noperm,forcemand,direct,nounix #MOUNT_OPTIONS=user=guest,pass=,rw,iocharset=utf8,noperm,forcemand,direct,nounix
# wine options since etercifs 4.4.5 enable full wine support
MOUNT_OPTIONS=user=guest,pass=,rw,iocharset=utf8,noperm,wine
# default path for share mounting # default path for share mounting
DEFAULT_MOUNTPOINT=/net/sharebase DEFAULT_MOUNTPOINT=/net/sharebase
# disable version checking
# disable package version checking
# CHECK_VERSION=0 # CHECK_VERSION=0
EOF EOF
%__subst "s|@DATADIR@|%_datadir/%name|g" functions.sh etercifs etermount
%__subst "s|@SYSCONFIGDIR@|%_sysconfigdir|g" functions.sh etercifs etermount
mkdir -p %buildroot%_datadir/%name/ mkdir -p %buildroot%_datadir/%name/
install -m644 buildmodule.sh %buildroot%_datadir/%name/ install -m644 buildmodule.sh %buildroot%_datadir/%name/
install -m644 functions.sh %buildroot%_datadir/%name/ install -m644 functions.sh %buildroot%_datadir/%name/
mkdir -p %buildroot%_initdir cat <<EOF >%buildroot%_datadir/%name/package.conf
install -m755 %name %buildroot%_initdir DATADIR=%_datadir/%name
install -m755 %name.outformat %buildroot%_initdir SRC_DIR=%_usrsrc/%name-%version
MODULENAME=%name
MODULEFILENAME=%name.ko
MODULEVERSION=%version
CHECK_VERSION=1
EOF
mkdir -p %buildroot%_initdir/
install -m755 %name %buildroot%_initdir/
install -m755 %name.outformat %buildroot%_initdir/
%define etercifs_src %_datadir/%name/sources %define etercifs_src %_datadir/%name/sources
...@@ -177,7 +193,7 @@ ln -s ../../../../%etercifs_src/%src_package_name-2.6.32-%src_2_6_32_version.tar ...@@ -177,7 +193,7 @@ ln -s ../../../../%etercifs_src/%src_package_name-2.6.32-%src_2_6_32_version.tar
%files %files
%doc README.ETER AUTHORS CHANGES README TODO %doc README.ETER AUTHORS CHANGES README TODO
%config %_sysconfdir/%name.conf %config %_sysconfigdir/%name.conf
%_datadir/%name/ %_datadir/%name/
%_initdir/%name %_initdir/%name
%_initdir/%name.outformat %_initdir/%name.outformat
......
...@@ -17,19 +17,26 @@ RMMOD=/sbin/rmmod ...@@ -17,19 +17,26 @@ RMMOD=/sbin/rmmod
MODPROBE=/sbin/modprobe MODPROBE=/sbin/modprobe
INSMOD=/sbin/insmod INSMOD=/sbin/insmod
if [ -f /etc/etercifs.conf ] ; then PACKAGEINFO=@DATADIR@/package.conf
. /etc/etercifs.conf if [ -f "$PACKAGEINFO" ] ; then
. $PACKAGEINFO/package.conf
else
fatal "Not found package information file $PACKAGEINFO"
fi
CONFIGFILE=@SYSCONFIGDIR@/etercifs.conf
if [ -f $CONFIGFILE ] ; then
. $CONFIGFILE
else
fatal "Not found configuration file $CONFIGFILE"
fi fi
[ -n "$SRC_DIR" ] || SRC_DIR=/usr/src
[ -n "$DATADIR" ] || DATADIR=/usr/share/etercifs
[ -n "$MODULENAME" ] || MODULENAME=etercifs
[ -n "$BUILT" ] || BUILT=0 [ -n "$BUILT" ] || BUILT=0
[ -n "$DKMS" ] || DKMS=1 [ -n "$DKMS" ] || DKMS=1
[ -n "$CHECK_VERSION" ] || CHECK_VERSION=1
ORIGMODULENAME=cifs ORIGMODULENAME=cifs
# FIXME: %_initdir
OUTFORMAT=/etc/init.d/outformat OUTFORMAT=/etc/init.d/outformat
[ -x $OUTFORMAT ] || OUTFORMAT=/etc/init.d/etercifs.outformat [ -x $OUTFORMAT ] || OUTFORMAT=/etc/init.d/etercifs.outformat
......
...@@ -11,12 +11,21 @@ fatal() ...@@ -11,12 +11,21 @@ fatal()
exit 1 exit 1
} }
if [ -f /etc/etercifs.conf ] ; then PACKAGEINFO=@DATADIR@/package.conf
. /etc/etercifs.conf if [ -f "$PACKAGEINFO" ] ; then
. $PACKAGEINFO/package.conf
else else
fatal "Not found configuration file /etc/etercifs.conf" fatal "Not found package information file $PACKAGEINFO"
fi fi
CONFIGFILE=@SYSCONFIGDIR@/etercifs.conf
if [ -f $CONFIGFILE ] ; then
. $CONFIGFILE
else
fatal "Not found configuration file $CONFIGFILE"
fi
# run via sudo under regular user
[ "$UID" = "0" ] && SUDO= || SUDO=sudo [ "$UID" = "0" ] && SUDO= || SUDO=sudo
create_share_dir() create_share_dir()
...@@ -37,7 +46,7 @@ help_text() ...@@ -37,7 +46,7 @@ help_text()
{ {
echo "The utility etermount performs mount network share on a protocol cifs" echo "The utility etermount performs mount network share on a protocol cifs"
echo "with pre-set parameters, which determined in MOUNT_OPTIONS variable" echo "with pre-set parameters, which determined in MOUNT_OPTIONS variable"
echo "in the config file /etc/etercifs.conf" echo "in the config file $CONFIGFILE"
echo "(current value of MOUNT_OPTIONS is '$MOUNT_OPTIONS')" echo "(current value of MOUNT_OPTIONS is '$MOUNT_OPTIONS')"
echo echo
echo "To mount the resource //server/share to the mountpoint /path/mountpoint" echo "To mount the resource //server/share to the mountpoint /path/mountpoint"
...@@ -45,8 +54,8 @@ help_text() ...@@ -45,8 +54,8 @@ help_text()
echo echo
echo "etermount <//server/share> [</path/mountpoint>]" echo "etermount <//server/share> [</path/mountpoint>]"
echo echo
echo "If the mountpoint isn't specified, it's default value is determined" echo "If the mountpoint isn't specified, will used"
echo "in the variable DEFAULT_MOUNTPOINT in the config file /etc/etercifs.conf" echo "variable DEFAULT_MOUNTPOINT from the config file $CONFIGFILE"
echo "(current value of DEFAULT_MOUNTPOINT is '$DEFAULT_MOUNTPOINT')." echo "(current value of DEFAULT_MOUNTPOINT is '$DEFAULT_MOUNTPOINT')."
echo echo
echo "Report bugs to <support@etersoft.ru>." echo "Report bugs to <support@etersoft.ru>."
......
...@@ -7,13 +7,20 @@ ...@@ -7,13 +7,20 @@
# Build kernel modules for all kernel and all platforms # Build kernel modules for all kernel and all platforms
if [ -f /etc/etercifs.conf ] ; then PACKAGEINFO=@DATADIR@/package.conf
. /etc/etercifs.conf if [ -f "$PACKAGEINFO" ] ; then
. $PACKAGEINFO/package.conf
else else
fatal "Not found configuration file /etc/etercifs.conf" fatal "Not found package information file $PACKAGEINFO"
fi
CONFIGFILE=@SYSCONFIGDIR@/etercifs.conf
if [ -f $CONFIGFILE ] ; then
. $CONFIGFILE
else
fatal "Not found configuration file $CONFIGFILE"
fi fi
MODULEFILENAME=etercifs.ko
[ -n "$TESTBUILD" ] || TESTBUILD=0 [ -n "$TESTBUILD" ] || TESTBUILD=0
[ -n "$DKMSBUILD" ] || DKMSBUILD=0 [ -n "$DKMSBUILD" ] || DKMSBUILD=0
...@@ -169,6 +176,7 @@ detect_host_kernel() ...@@ -169,6 +176,7 @@ detect_host_kernel()
check_headers() check_headers()
{ {
if [ ! -f $KERNSRC/include/linux/version.h ]; then if [ ! -f $KERNSRC/include/linux/version.h ]; then
# TODO: use distr_vendor
cat >&2 <<EOF cat >&2 <<EOF
Error: no kernel headers found at $KERNSRC Error: no kernel headers found at $KERNSRC
Please install package Please install package
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment