Magellan Linux

Diff of /branches/R11-unstable/include/mtools.sminc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/core/include/mtools.sminc revision 4806 by niro, Sun Jan 3 20:27:59 2010 UTC branches/magellan-next/include/mtools.sminc revision 8642 by niro, Wed Jul 27 11:09:50 2011 UTC
# Line 9  INHERITS="${INHERITS} mtools" Line 9  INHERITS="${INHERITS} mtools"
9  mpname()  mpname()
10  {  {
11   local pname="${PNAME}"   local pname="${PNAME}"
12   [[ ! -z ${SPLIT_PACKAGE_BASE} ]] && pname ="${SPLIT_PACKAGE_BASE}"   [[ ! -z ${SPLIT_PACKAGE_BASE} ]] && pname="${SPLIT_PACKAGE_BASE}"
13    
14   echo "${pname}"   echo "${pname}"
15  }  }
16    
17    # get the bindir right with splitpackages
18    mbindir()
19    {
20     echo "${BINDIR}"
21    }
22    
23  # installs initscripts  # installs initscripts
24  # minstallrc /path/to/rc-script {destfilename}  # minstallrc /path/to/rc-script {destfilename}
25  minstallrc()  minstallrc()
# Line 755  mlink() Line 761  mlink()
761    
762   ln ${verbose} -snf ${symlink} ${BINDIR}/${pathto} || die   ln ${verbose} -snf ${symlink} ${BINDIR}/${pathto} || die
763  }  }
764    
765    # installs systemd units
766    # minstallunit /path/to/unit-file {destfilename}
767    minstallunit()
768    {
769     local unit
770     local file
771    
772     [[ -z "$1" ]] && die "No unit given"
773    
774     # if no fullpath given use file from sourcedir
775     if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]]
776     then
777     file="${SOURCEDIR}/$(mpname)/$1"
778     else
779     file="$1"
780     fi
781    
782     if [[ -n "$2" ]]
783     then
784     unit="$2"
785     else
786     unit="$(basename ${file})"
787     fi
788    
789     # needed directory
790     install -d ${BINDIR}/lib/systemd/system || die
791    
792     # install our initscript
793     install -v -m 0644 -o root -g root ${file} ${BINDIR}/lib/systemd/system/${unit} || die
794    }
795    
796    # installs systemd tmp configs to /etc/tmpfiles.d
797    # minstalltmp /path/to/tmpdfile {destfilename}
798    minstalltmp()
799    {
800     local tmpdfile
801     local file
802    
803     [[ -z "$1" ]] && die "No tmpd file given"
804    
805     # if no fullpath given use file from sourcedir
806     if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]]
807     then
808     file="${SOURCEDIR}/$(mpname)/$1"
809     else
810     file="$1"
811     fi
812    
813     if [[ -n "$2" ]]
814     then
815     tmpdfile="$2"
816     else
817     tmpdfile="$(basename ${file})"
818     fi
819    
820     # needed directory
821     install -d ${BINDIR}/etc/tmpfiles.d || die
822    
823     # install our tmpdfile
824     install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/tmpfiles.d/${tmpdfile} || die
825    }
826    
827    mclearconfig()
828    {
829     local confdir
830     local prefix="${BINDIR}"
831     [[ -z ${MCONFIG} ]] && die "No \$MCONFIG given!"
832    
833     # no bindir prefix if requested
834     case $1 in
835     -b|--no-bindir) prefix="";;
836     esac
837    
838     confdir="$(dirname ${MCONFIG})"
839     if [[ ! -d ${prefix}/${confdir} ]]
840     then
841     install -d ${prefix}/${confdir} || die
842     fi
843     : > ${prefix}/${MCONFIG}
844    }
845    
846    maddconfig()
847    {
848     local argv="$1"
849     local confdir
850     local prefix="${BINDIR}"
851    
852     [[ -z ${MCONFIG} ]] && die "No \$MCONFIG given!"
853    
854     # no bindir prefix if requested
855     case $1 in
856     -b|--no-bindir) prefix=""; argv="$2" ;;
857     esac
858    
859     [[ -z ${argv} ]] && die "No  argument given!"
860    
861     confdir="$(dirname ${MCONFIG})"
862     if [[ ! -d ${prefix}/${confdir} ]]
863     then
864     install -d ${prefix}/${confdir} || die
865     fi
866     echo "${argv}" >> ${prefix}/${MCONFIG} || die
867    }

Legend:
Removed from v.4806  
changed lines
  Added in v.8642