Magellan Linux

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

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

branches/magellan-next/include/mtools.sminc revision 6654 by niro, Tue Sep 14 16:46:32 2010 UTC trunk/include/mtools.sminc revision 11761 by niro, Tue Mar 27 12:11:21 2012 UTC
# Line 468  minstallcron() Line 468  minstallcron()
468    
469    
470  # installs logrotate configuration files  # installs logrotate configuration files
471  # minstallpam /path/to/logrotatefile {destfilename}  # minstalllog /path/to/logrotatefile {destfilename}
472  minstalllog()  minstalllog()
473  {  {
474   local logfile   local logfile
# Line 636  mcopy() Line 636  mcopy()
636   # recursive   # recursive
637   if [[ $1 = -r ]] || [[ $1 = -R ]]   if [[ $1 = -r ]] || [[ $1 = -R ]]
638   then   then
639   opts="--recursive"   opts="-R"
640   source="$2"   source="$2"
641   dest="$3"   dest="$3"
642   fi   fi
# Line 644  mcopy() Line 644  mcopy()
644   # recursive   # recursive
645   if [[ $1 = -rf ]] || [[ $1 = -fr ]] || [[ $1 = -Rf ]] || [[ $1 = -fR ]]   if [[ $1 = -rf ]] || [[ $1 = -fr ]] || [[ $1 = -Rf ]] || [[ $1 = -fR ]]
646   then   then
647   opts="--recursive --force"   opts="-R -f"
648     source="$2"
649     dest="$3"
650     fi
651    
652     if [[ $1 = -a ]]
653     then
654     opts="-a"
655   source="$2"   source="$2"
656   dest="$3"   dest="$3"
657   fi   fi
# Line 664  mmove() Line 671  mmove()
671   # force   # force
672   if [[ $1 = -f ]]   if [[ $1 = -f ]]
673   then   then
674   opts="--force"   opts="-f"
675   source="$2"   source="$2"
676   dest="$3"   dest="$3"
677   fi   fi
# Line 710  mchown() Line 717  mchown()
717   # recursive   # recursive
718   if [[ $1 = -r ]] || [[ $1 = -R ]]   if [[ $1 = -r ]] || [[ $1 = -R ]]
719   then   then
720   local recursive="--recursive"   local recursive="-R"
721   local owner="$2"   local owner="$2"
722   local path="$3"   local path="$3"
723   fi   fi
# Line 730  mchmod() Line 737  mchmod()
737   # recursive   # recursive
738   if [[ $1 = -r ]] || [[ $1 = -R ]]   if [[ $1 = -r ]] || [[ $1 = -R ]]
739   then   then
740   local recursive="--recursive"   local recursive="-R"
741   local posix="$2"   local posix="$2"
742   local path="$3"   local path="$3"
743   fi   fi
# Line 755  mlink() Line 762  mlink()
762    
763   ln ${verbose} -snf ${symlink} ${BINDIR}/${pathto} || die   ln ${verbose} -snf ${symlink} ${BINDIR}/${pathto} || die
764  }  }
765    
766    # installs systemd units
767    # minstallunit /path/to/unit-file {destfilename}
768    minstallunit()
769    {
770     local unit
771     local file
772     local prefix
773    
774     [[ -z "$1" ]] && die "No unit given"
775    
776     # get the right prefix for newer systemd
777     [[ -x /bin/systemctl ]] && prefix=""
778     [[ -x /usr/bin/systemctl ]] && prefix="/usr"
779    
780     # if no fullpath given use file from sourcedir
781     if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]]
782     then
783     file="${SOURCEDIR}/$(mpname)/$1"
784     else
785     file="$1"
786     fi
787    
788     if [[ -n "$2" ]]
789     then
790     unit="$2"
791     else
792     unit="$(basename ${file})"
793     fi
794    
795     # needed directory
796     install -d ${BINDIR}${prefix}/lib/systemd/system || die
797    
798     # install our initscript
799     install -v -m 0644 -o root -g root ${file} ${BINDIR}${prefix}/lib/systemd/system/${unit} || die
800    }
801    
802    # installs systemd tmp configs to /etc/tmpfiles.d
803    # minstalltmp /path/to/tmpdfile {destfilename}
804    minstalltmp()
805    {
806     local tmpdfile
807     local file
808    
809     [[ -z "$1" ]] && die "No tmpd file given"
810    
811     # if no fullpath given use file from sourcedir
812     if [[ -z $(dirname $1) ]] || [[ $(dirname $1) = . ]]
813     then
814     file="${SOURCEDIR}/$(mpname)/$1"
815     else
816     file="$1"
817     fi
818    
819     if [[ -n "$2" ]]
820     then
821     tmpdfile="$2"
822     else
823     tmpdfile="$(basename ${file})"
824     fi
825    
826     # needed directory
827     install -d ${BINDIR}/etc/tmpfiles.d || die
828    
829     # install our tmpdfile
830     install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/tmpfiles.d/${tmpdfile} || die
831    }
832    
833    mclearconfig()
834    {
835     local confdir
836     local prefix="${BINDIR}"
837     [[ -z ${MCONFIG} ]] && die "No \$MCONFIG given!"
838    
839     # no bindir prefix if requested
840     case $1 in
841     -b|--no-bindir) prefix="";;
842     esac
843    
844     confdir="$(dirname ${MCONFIG})"
845     if [[ ! -d ${prefix}/${confdir} ]]
846     then
847     install -d ${prefix}/${confdir} || die
848     fi
849     : > ${prefix}/${MCONFIG}
850    }
851    
852    maddconfig()
853    {
854     local argv="$1"
855     local confdir
856     local prefix="${BINDIR}"
857    
858     [[ -z ${MCONFIG} ]] && die "No \$MCONFIG given!"
859    
860     # no bindir prefix if requested
861     case $1 in
862     -b|--no-bindir) prefix=""; argv="$2" ;;
863     esac
864    
865     [[ -z ${argv} ]] && die "No  argument given!"
866    
867     confdir="$(dirname ${MCONFIG})"
868     if [[ ! -d ${prefix}/${confdir} ]]
869     then
870     install -d ${prefix}/${confdir} || die
871     fi
872     echo "${argv}" >> ${prefix}/${MCONFIG} || die
873    }

Legend:
Removed from v.6654  
changed lines
  Added in v.11761