[79659] branches/gsoc11-statistics/base
derek at macports.org
derek at macports.org
Wed Jun 22 12:40:24 PDT 2011
Revision: 79659
http://trac.macports.org/changeset/79659
Author: derek at macports.org
Date: 2011-06-22 12:40:24 -0700 (Wed, 22 Jun 2011)
Log Message:
-----------
Renamed install_launchd.sh to setupstats.sh
Modified Makefile.in accordingly
Modified Paths:
--------------
branches/gsoc11-statistics/base/Makefile.in
Added Paths:
-----------
branches/gsoc11-statistics/base/setupstats.sh
Removed Paths:
-------------
branches/gsoc11-statistics/base/install_launchd.sh
Modified: branches/gsoc11-statistics/base/Makefile.in
===================================================================
--- branches/gsoc11-statistics/base/Makefile.in 2011-06-22 19:21:43 UTC (rev 79658)
+++ branches/gsoc11-statistics/base/Makefile.in 2011-06-22 19:40:24 UTC (rev 79659)
@@ -36,8 +36,9 @@
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 setupenv.bash $(DESTDIR)${datadir}/macports/
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 macports-pubkey.pem $(DESTDIR)${datadir}/macports/
$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 544 submitstats.sh $(DESTDIR)${datadir}/macports/
- # Install launchd script that runs submistats.sh
- ./install_launchd.sh $(DESTDIR)${datadir}/macports/submitstats.sh $(DESTDIR)${sysconfdir}/macports/macports.conf
+# Install launchd script that runs submistats.sh
+ ./setupstats.sh $(DESTDIR)${datadir}/macports/submitstats.sh $(DESTDIR)${sysconfdir}/macports/macports.conf
+
# Only run these scripts when not building in a destroot
ifeq ($(DESTDIR),)
# Add [default] tag to the central MacPorts repository, if it isn't already
Deleted: branches/gsoc11-statistics/base/install_launchd.sh
===================================================================
--- branches/gsoc11-statistics/base/install_launchd.sh 2011-06-22 19:21:43 UTC (rev 79658)
+++ branches/gsoc11-statistics/base/install_launchd.sh 2011-06-22 19:40:24 UTC (rev 79659)
@@ -1,90 +0,0 @@
-#!/bin/sh
-
-#
-
-# Where the generated plist should be written
-PLIST=/Library/LaunchAgents/org.macports.stats.plist
-
-die () {
- echo >&2 "$@"
- exit 1
-}
-
-# Make sure exactly 2 arguments are provided
-[ "$#" -eq 2 ] || die "exactly two arguments required"
-
-# $1 must be the path to the script launchd will execute
-SCRIPT=$1
-
-# $2 is the path to the MacPorts configuration file
-CONFIG=$2
-
-# Make sure the script argument is executable
-if [ ! -x "$SCRIPT" ]; then
- die "$SCRIPT is not a valid executable"
-fi
-
-# Make sure the config file exists
-if [ ! -f "$CONFIG" ]; then
- die "$CONFIG does not exist"
-fi
-
-# Determine the day and time that launchd should run the script
-setup_times() {
- # Get hardware uuid - Hardware UUID: UUID
- huuid=`system_profiler SPHardwareDataType | grep "Hardware UUID"`
-
- # Strip out Hardware UUID:
- huuid=`echo $huuid | awk '/Hardware UUID/ {print $3;}'`
-
- # Strip out '-' characters
- huuid=`echo $huuid | tr -d -`
-
- # Weekday is hardware uuid mod 7
- weekday=`echo $huuid % 7 | bc`
-
- # Use current hours and minute
- hour=`date '+%H'`
- minute=`date '+%M'`
-}
-
-# Generate the launchd plist that executes 'port stats submit'
-# Outputs to the file $plist
-generate_plist() {
- setup_times
- cat <<-EOF > $PLIST
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0">
- <dict>
- <key>Label</key>
- <string>org.macports.stats</string>
- <key>ProgramArguments</key>
- <array>
- <string>$SCRIPT</string>
- <string>$CONFIG</string>
- </array>
- <key>StartCalendarInterval</key>
- <dict>
- <key>Weekday</key>
- <integer>$weekday</integer>
- <key>Hour</key>
- <integer>$hour</integer>
- <key>Minute</key>
- <integer>$minute</integer>
- </dict>
- </dict>
- </plist>
- EOF
-}
-
-# Install the plist using launchctl
-install_plist() {
- launchctl load -w -F $PLIST
-}
-
-# Generate and install the plist
-generate_plist
-install_plist
-
-
Copied: branches/gsoc11-statistics/base/setupstats.sh (from rev 79529, branches/gsoc11-statistics/base/install_launchd.sh)
===================================================================
--- branches/gsoc11-statistics/base/setupstats.sh (rev 0)
+++ branches/gsoc11-statistics/base/setupstats.sh 2011-06-22 19:40:24 UTC (rev 79659)
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+#
+
+# Where the generated plist should be written
+PLIST=/Library/LaunchAgents/org.macports.stats.plist
+
+die () {
+ echo >&2 "$@"
+ exit 1
+}
+
+# Make sure exactly 2 arguments are provided
+[ "$#" -eq 2 ] || die "exactly two arguments required"
+
+# $1 must be the path to the script launchd will execute
+SCRIPT=$1
+
+# $2 is the path to the MacPorts configuration file
+CONFIG=$2
+
+# Make sure the script argument is executable
+if [ ! -x "$SCRIPT" ]; then
+ die "$SCRIPT is not a valid executable"
+fi
+
+# Make sure the config file exists
+if [ ! -f "$CONFIG" ]; then
+ die "$CONFIG does not exist"
+fi
+
+# Determine the day and time that launchd should run the script
+setup_times() {
+ # Get hardware uuid - Hardware UUID: UUID
+ huuid=`system_profiler SPHardwareDataType | grep "Hardware UUID"`
+
+ # Strip out Hardware UUID:
+ huuid=`echo $huuid | awk '/Hardware UUID/ {print $3;}'`
+
+ # Strip out '-' characters
+ huuid=`echo $huuid | tr -d -`
+
+ # Weekday is hardware uuid mod 7
+ weekday=`echo $huuid % 7 | bc`
+
+ # Use current hours and minute
+ hour=`date '+%H'`
+ minute=`date '+%M'`
+}
+
+# Generate the launchd plist that executes 'port stats submit'
+# Outputs to the file $plist
+generate_plist() {
+ setup_times
+ cat <<-EOF > $PLIST
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <dict>
+ <key>Label</key>
+ <string>org.macports.stats</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>$SCRIPT</string>
+ <string>$CONFIG</string>
+ </array>
+ <key>StartCalendarInterval</key>
+ <dict>
+ <key>Weekday</key>
+ <integer>$weekday</integer>
+ <key>Hour</key>
+ <integer>$hour</integer>
+ <key>Minute</key>
+ <integer>$minute</integer>
+ </dict>
+ </dict>
+ </plist>
+ EOF
+}
+
+# Install the plist using launchctl
+install_plist() {
+ launchctl load -w -F $PLIST
+}
+
+# Generate and install the plist
+generate_plist
+install_plist
+
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110622/c25afce6/attachment.html>
More information about the macports-changes
mailing list