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 @@
%define src_2_6_31_version 1.60
%define src_2_6_32_version 1.61
# TODO: moved to rpm-build-altlinux-compat
%define _sysconfigdir %_sysconfdir/sysconfig
Name: etercifs
Version: 4.4.5
Release: alt1
Release: alt2
Summary: Advanced Common Internet File System for Linux with Etersoft extension
......@@ -99,29 +102,42 @@ though.
%setup
%install
mkdir -p %buildroot%_sysconfdir/
cat <<EOF >%buildroot%_sysconfdir/%name.conf
DATADIR=%_datadir/%name
SRC_DIR=%_usrsrc/%name-%version
MODULENAME=%name
MODULEVERSION=%version
mkdir -p %buildroot%_sysconfigdir
cat <<EOF >%buildroot%_sysconfigdir/%name.conf
# etercifs configuration file
# 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_MOUNTPOINT=/net/sharebase
# disable version checking
# disable package version checking
# CHECK_VERSION=0
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/
install -m644 buildmodule.sh %buildroot%_datadir/%name/
install -m644 functions.sh %buildroot%_datadir/%name/
mkdir -p %buildroot%_initdir
install -m755 %name %buildroot%_initdir
install -m755 %name.outformat %buildroot%_initdir
cat <<EOF >%buildroot%_datadir/%name/package.conf
DATADIR=%_datadir/%name
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
......@@ -177,7 +193,7 @@ ln -s ../../../../%etercifs_src/%src_package_name-2.6.32-%src_2_6_32_version.tar
%files
%doc README.ETER AUTHORS CHANGES README TODO
%config %_sysconfdir/%name.conf
%config %_sysconfigdir/%name.conf
%_datadir/%name/
%_initdir/%name
%_initdir/%name.outformat
......
......@@ -17,19 +17,26 @@ RMMOD=/sbin/rmmod
MODPROBE=/sbin/modprobe
INSMOD=/sbin/insmod
if [ -f /etc/etercifs.conf ] ; then
. /etc/etercifs.conf
PACKAGEINFO=@DATADIR@/package.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
[ -n "$SRC_DIR" ] || SRC_DIR=/usr/src
[ -n "$DATADIR" ] || DATADIR=/usr/share/etercifs
[ -n "$MODULENAME" ] || MODULENAME=etercifs
[ -n "$BUILT" ] || BUILT=0
[ -n "$DKMS" ] || DKMS=1
[ -n "$CHECK_VERSION" ] || CHECK_VERSION=1
ORIGMODULENAME=cifs
# FIXME: %_initdir
OUTFORMAT=/etc/init.d/outformat
[ -x $OUTFORMAT ] || OUTFORMAT=/etc/init.d/etercifs.outformat
......
......@@ -11,12 +11,21 @@ fatal()
exit 1
}
if [ -f /etc/etercifs.conf ] ; then
. /etc/etercifs.conf
PACKAGEINFO=@DATADIR@/package.conf
if [ -f "$PACKAGEINFO" ] ; then
. $PACKAGEINFO/package.conf
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
# run via sudo under regular user
[ "$UID" = "0" ] && SUDO= || SUDO=sudo
create_share_dir()
......@@ -37,7 +46,7 @@ help_text()
{
echo "The utility etermount performs mount network share on a protocol cifs"
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
echo "To mount the resource //server/share to the mountpoint /path/mountpoint"
......@@ -45,8 +54,8 @@ help_text()
echo
echo "etermount <//server/share> [</path/mountpoint>]"
echo
echo "If the mountpoint isn't specified, it's default value is determined"
echo "in the variable DEFAULT_MOUNTPOINT in the config file /etc/etercifs.conf"
echo "If the mountpoint isn't specified, will used"
echo "variable DEFAULT_MOUNTPOINT from the config file $CONFIGFILE"
echo "(current value of DEFAULT_MOUNTPOINT is '$DEFAULT_MOUNTPOINT')."
echo
echo "Report bugs to <support@etersoft.ru>."
......
......@@ -7,13 +7,20 @@
# Build kernel modules for all kernel and all platforms
if [ -f /etc/etercifs.conf ] ; then
. /etc/etercifs.conf
PACKAGEINFO=@DATADIR@/package.conf
if [ -f "$PACKAGEINFO" ] ; then
. $PACKAGEINFO/package.conf
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
MODULEFILENAME=etercifs.ko
[ -n "$TESTBUILD" ] || TESTBUILD=0
[ -n "$DKMSBUILD" ] || DKMSBUILD=0
......@@ -169,6 +176,7 @@ detect_host_kernel()
check_headers()
{
if [ ! -f $KERNSRC/include/linux/version.h ]; then
# TODO: use distr_vendor
cat >&2 <<EOF
Error: no kernel headers found at $KERNSRC
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