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 7876 by niro, Thu Jun 2 20:53:54 2011 UTC trunk/include/mtools.sminc revision 12655 by niro, Tue Jun 26 16:15:58 2012 UTC
# Line 150  minstalludevrule() Line 150  minstalludevrule()
150  {  {
151   local udevrule   local udevrule
152   local file   local file
153     local udevrulesddir="/usr/lib/udev/rules.d"
154    
155   [[ -z "$1" ]] && die "No udev rule given"   [[ -z "$1" ]] && die "No udev rule given"
156    
# Line 169  minstalludevrule() Line 170  minstalludevrule()
170   fi   fi
171    
172   # needed directory   # needed directory
173   install -d ${BINDIR}/etc/udev/rules.d || die   install -d ${BINDIR}${udevrulesddir} || die
174    
175   # install our udev rule   # install our udev rule
176   install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/udev/rules.d/${udevrule} || die   install -v -m 0644 -o root -g root ${file} ${BINDIR}${udevrulesddir}/${udevrule} || die
177  }  }
178    
179  minstalludevhelper()  minstalludevhelper()
180  {  {
181   local udevhelper   local udevhelper
182   local file   local file
183     local udevdir="/usr/lib/udev"
184    
185   [[ -z "$1" ]] && die "No udev helper given"   [[ -z "$1" ]] && die "No udev helper given"
186    
# Line 198  minstalludevhelper() Line 200  minstalludevhelper()
200   fi   fi
201    
202   # needed directory   # needed directory
203   install -d ${BINDIR}/lib/udev || die   install -d ${BINDIR}${udevdir} || die
204    
205   # install our udev-helper   # install our udev-helper
206   install -v -m 0755 -o root -g root ${file} ${BINDIR}/lib/udev/${udevhelper} || die   install -v -m 0755 -o root -g root ${file} ${BINDIR}${udevdir}/${udevhelper} || die
207  }  }
208    
209  minstallhalinformation()  minstallhalinformation()
# Line 468  minstallcron() Line 470  minstallcron()
470    
471    
472  # installs logrotate configuration files  # installs logrotate configuration files
473  # minstallpam /path/to/logrotatefile {destfilename}  # minstalllog /path/to/logrotatefile {destfilename}
474  minstalllog()  minstalllog()
475  {  {
476   local logfile   local logfile
# Line 636  mcopy() Line 638  mcopy()
638   # recursive   # recursive
639   if [[ $1 = -r ]] || [[ $1 = -R ]]   if [[ $1 = -r ]] || [[ $1 = -R ]]
640   then   then
641   opts="--recursive"   opts="-R"
642   source="$2"   source="$2"
643   dest="$3"   dest="$3"
644   fi   fi
# Line 644  mcopy() Line 646  mcopy()
646   # recursive   # recursive
647   if [[ $1 = -rf ]] || [[ $1 = -fr ]] || [[ $1 = -Rf ]] || [[ $1 = -fR ]]   if [[ $1 = -rf ]] || [[ $1 = -fr ]] || [[ $1 = -Rf ]] || [[ $1 = -fR ]]
648   then   then
649   opts="--recursive --force"   opts="-R -f"
650     source="$2"
651     dest="$3"
652     fi
653    
654     if [[ $1 = -a ]]
655     then
656     opts="-a"
657   source="$2"   source="$2"
658   dest="$3"   dest="$3"
659   fi   fi
# Line 655  mcopy() Line 664  mcopy()
664   cp -v ${opts} ${source} ${BINDIR}/${dest} || die   cp -v ${opts} ${source} ${BINDIR}/${dest} || die
665  }  }
666    
667    mdelete()
668    {
669     local dest="$1"
670     local opts
671    
672     # recursive
673     if [[ $1 = -r ]] || [[ $1 = -R ]]
674     then
675     opts="-r"
676     dest="$2"
677     fi
678    
679     # recursive
680     if [[ $1 = -rf ]] || [[ $1 = -fr ]] || [[ $1 = -Rf ]] || [[ $1 = -fR ]]
681     then
682     opts="-r -f"
683     dest="$2"
684     fi
685    
686     [[ -z ${dest} ]] && die "No dest given."
687     [[ ! -e ${BINDIR}/${dest} ]] && die "${BINDIR}/${dest} does not exist."
688    
689     rm -v ${opts} ${BINDIR}/${dest} || die
690    }
691    
692  mmove()  mmove()
693  {  {
694   local source="$1"   local source="$1"
# Line 664  mmove() Line 698  mmove()
698   # force   # force
699   if [[ $1 = -f ]]   if [[ $1 = -f ]]
700   then   then
701   opts="--force"   opts="-f"
702   source="$2"   source="$2"
703   dest="$3"   dest="$3"
704   fi   fi
# Line 710  mchown() Line 744  mchown()
744   # recursive   # recursive
745   if [[ $1 = -r ]] || [[ $1 = -R ]]   if [[ $1 = -r ]] || [[ $1 = -R ]]
746   then   then
747   local recursive="--recursive"   local recursive="-R"
748   local owner="$2"   local owner="$2"
749   local path="$3"   local path="$3"
750   fi   fi
# Line 730  mchmod() Line 764  mchmod()
764   # recursive   # recursive
765   if [[ $1 = -r ]] || [[ $1 = -R ]]   if [[ $1 = -r ]] || [[ $1 = -R ]]
766   then   then
767   local recursive="--recursive"   local recursive="-R"
768   local posix="$2"   local posix="$2"
769   local path="$3"   local path="$3"
770   fi   fi
# Line 762  minstallunit() Line 796  minstallunit()
796  {  {
797   local unit   local unit
798   local file   local file
799     local systemdunitdir="/usr/lib/systemd/system"
800    
801   [[ -z "$1" ]] && die "No unit given"   [[ -z "$1" ]] && die "No unit given"
802    
# Line 781  minstallunit() Line 816  minstallunit()
816   fi   fi
817    
818   # needed directory   # needed directory
819   install -d ${BINDIR}/lib/systemd/system || die   install -d ${BINDIR}${prefix}${systemdunitdir} || die
820    
821   # install our initscript   # install our initscript
822   install -v -m 0644 -o root -g root ${file} ${BINDIR}/lib/systemd/system/${unit} || die   install -v -m 0644 -o root -g root ${file} ${BINDIR}${prefix}${systemdunitdir}/${unit} || die
823  }  }
824    
825  # installs systemd tmp configs to /etc/tmpfiles.d  # installs systemd tmp configs to /etc/tmpfiles.d
# Line 817  minstalltmp() Line 852  minstalltmp()
852   # install our tmpdfile   # install our tmpdfile
853   install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/tmpfiles.d/${tmpdfile} || die   install -v -m 0644 -o root -g root ${file} ${BINDIR}/etc/tmpfiles.d/${tmpdfile} || die
854  }  }
855    
856    mclearconfig()
857    {
858     local confdir
859     local prefix="${BINDIR}"
860     [[ -z ${MCONFIG} ]] && die "No \$MCONFIG given!"
861    
862     # no bindir prefix if requested
863     case $1 in
864     -b|--no-bindir) prefix="";;
865     esac
866    
867     confdir="$(dirname ${MCONFIG})"
868     if [[ ! -d ${prefix}/${confdir} ]]
869     then
870     install -d ${prefix}/${confdir} || die
871     fi
872     : > ${prefix}/${MCONFIG}
873    }
874    
875    maddconfig()
876    {
877     local argv="$1"
878     local confdir
879     local prefix="${BINDIR}"
880    
881     [[ -z ${MCONFIG} ]] && die "No \$MCONFIG given!"
882    
883     # no bindir prefix if requested
884     case $1 in
885     -b|--no-bindir) prefix=""; argv="$2" ;;
886     esac
887    
888     [[ -z ${argv} ]] && die "No  argument given!"
889    
890     confdir="$(dirname ${MCONFIG})"
891     if [[ ! -d ${prefix}/${confdir} ]]
892     then
893     install -d ${prefix}/${confdir} || die
894     fi
895     echo "${argv}" >> ${prefix}/${MCONFIG} || die
896    }

Legend:
Removed from v.7876  
changed lines
  Added in v.12655