|
From: <abe...@us...> - 2015-08-20 17:12:57
|
Revision: 7206
http://sourceforge.net/p/astlinux/code/7206
Author: abelbeck
Date: 2015-08-20 17:12:55 +0000 (Thu, 20 Aug 2015)
Log Message:
-----------
fossil, add rc.conf variables FOSSIL_DEFAULT_FILES and FOSSIL_INCLUDE_FILES, add a lockfile for fossil-update, and automatically perform a 'fossil-update' after creating a new repo.
Modified Paths:
--------------
branches/1.0/package/fossil/fossil.init
branches/1.0/package/fossil/scripts/fossil-close
branches/1.0/package/fossil/scripts/fossil-open
branches/1.0/package/fossil/scripts/fossil-update
branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf
Modified: branches/1.0/package/fossil/fossil.init
===================================================================
--- branches/1.0/package/fossil/fossil.init 2015-08-20 04:12:09 UTC (rev 7205)
+++ branches/1.0/package/fossil/fossil.init 2015-08-20 17:12:55 UTC (rev 7206)
@@ -37,6 +37,8 @@
fossil sqlite3 "REPLACE INTO config VALUES('project-name','${HOSTNAME}',now());" -R $REPO
fossil sqlite3 "REPLACE INTO config VALUES('timeline-utc','0',now());" -R $REPO
fossil sqlite3 "REPLACE INTO config VALUES('require-captcha','0',now());" -R $REPO
+
+ fossil-update "initial default check-in" >/dev/null
fi
fi
}
@@ -54,6 +56,12 @@
stop()
{
+ # Close any open fossil checkouts
+ if [ -f /mnt/kd/.fslckout ]; then
+ echo "Closing fossil checkout..."
+ fossil-close
+ fi
+
if [ -f $PIDFILE ]; then
echo "Stopping fossil..."
Modified: branches/1.0/package/fossil/scripts/fossil-close
===================================================================
--- branches/1.0/package/fossil/scripts/fossil-close 2015-08-20 04:12:09 UTC (rev 7205)
+++ branches/1.0/package/fossil/scripts/fossil-close 2015-08-20 17:12:55 UTC (rev 7206)
@@ -1,7 +1,14 @@
#!/bin/sh
+LOCKFILE="/var/lock/fossil-update.lock"
+
if ! cd /mnt/kd; then
exit 1
fi
+if [ -f "$LOCKFILE" ]; then
+ echo "fossil-update: already running, lockfile \"$LOCKFILE\" exists, process id: $(cat "$LOCKFILE")." >&2
+ exit 9
+fi
+
fossil close --force
Modified: branches/1.0/package/fossil/scripts/fossil-open
===================================================================
--- branches/1.0/package/fossil/scripts/fossil-open 2015-08-20 04:12:09 UTC (rev 7205)
+++ branches/1.0/package/fossil/scripts/fossil-open 2015-08-20 17:12:55 UTC (rev 7206)
@@ -2,6 +2,8 @@
REPO="/mnt/kd/fossil/astlinux.fossil"
+LOCKFILE="/var/lock/fossil-update.lock"
+
if [ ! -f $REPO ]; then
echo "Fossil repository not found: $REPO" >&2
exit 1
@@ -11,5 +13,10 @@
exit 1
fi
+if [ -f "$LOCKFILE" ]; then
+ echo "fossil-update: already running, lockfile \"$LOCKFILE\" exists, process id: $(cat "$LOCKFILE")." >&2
+ exit 9
+fi
+
fossil open $REPO --keep >/dev/null
fossil status
Modified: branches/1.0/package/fossil/scripts/fossil-update
===================================================================
--- branches/1.0/package/fossil/scripts/fossil-update 2015-08-20 04:12:09 UTC (rev 7205)
+++ branches/1.0/package/fossil/scripts/fossil-update 2015-08-20 17:12:55 UTC (rev 7206)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
. /etc/rc.conf
@@ -8,6 +8,8 @@
REPO="/mnt/kd/fossil/astlinux.fossil"
+LOCKFILE="/var/lock/fossil-update.lock"
+
if [ ! -f $REPO ]; then
echo "Fossil repository not found: $REPO" >&2
exit 1
@@ -17,6 +19,14 @@
exit 1
fi
+# Robust 'bash' method of creating/testing for a lockfile
+if ! ( set -o noclobber; echo "$$" > "$LOCKFILE" ) 2>/dev/null; then
+ echo "fossil-update: already running, lockfile \"$LOCKFILE\" exists, process id: $(cat "$LOCKFILE")." >&2
+ exit 9
+fi
+
+trap 'rm -f "$LOCKFILE"; exit $?' INT TERM EXIT
+
fossil open $REPO --keep >/dev/null
fossil status
@@ -25,19 +35,29 @@
if [ -n "$FOSSIL_DEFAULT_DIRS" ]; then
dirs="$FOSSIL_DEFAULT_DIRS"
else
- dirs="rc.conf.d monit/monit.d"
+ dirs="rc.conf.d monit/monit.d openvpn/ccd"
if [ "$ASTERISK_DAHDI_DISABLE" != "yes" ]; then
dirs="$dirs asterisk dahdi fop2 phoneprov/templates"
fi
fi
+files="${FOSSIL_DEFAULT_FILES:-rc.elocal rc.local rc.local.stop dnsmasq.static}"
+
unset IFS
for dir in $dirs $FOSSIL_INCLUDE_DIRS; do
- if [ -d $dir ]; then
- fossil add --force $dir
+ if [ "$dir" != "/mnt/kd" -a "$dir" != "/mnt/kd/" -a -d "$dir" ]; then
+ fossil add --ignore '*.bak,*.db' --force "$dir"
fi
done
+for file in $files $FOSSIL_INCLUDE_FILES; do
+ if [ -f "$file" ]; then
+ if ! fossil ls "${file#/mnt/kd/}" | grep -q "${file#/mnt/kd/}"; then
+ fossil add --force "$file"
+ fi
+ fi
+done
+
## Check for locally deleted files, remove them from the repo
if fossil changes | grep -q '^MISSING'; then
fossil changes | awk '/^MISSING/ { print $2; }' | xargs fossil forget
@@ -48,4 +68,7 @@
fossil close --force
+rm -f "$LOCKFILE"
+trap - INT TERM EXIT
+
exit $rtn
Modified: branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf
===================================================================
--- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2015-08-20 04:12:09 UTC (rev 7205)
+++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2015-08-20 17:12:55 UTC (rev 7206)
@@ -1099,6 +1099,16 @@
#MONIT_NOTIFY="no...@my..." # Notify via email, space separate multiple email addresses
#MONIT_NOTIFY_FROM="mo...@my..." # Optional, From: email address
+## Fossil-Software Configuration Management
+## Enable Fossil server by setting FOSSIL_SERVER="yes"
+#FOSSIL_SERVER="yes"
+## Note: All directory and file names are relative to /mnt/kd/
+## Space separate multiple directory and/or file names.
+#FOSSIL_DEFAULT_DIRS="" # Directory name(s), override the default set of directories: rc.conf.d asterisk dahdi etc.
+#FOSSIL_DEFAULT_FILES="" # File name(s), override the default set of files: rc.local rc.elocal dnsmasq.static etc.
+#FOSSIL_INCLUDE_DIRS="snmp" # Directory name(s), additional directories that are monitored for new added files and sub-dirs.
+#FOSSIL_INCLUDE_FILES="*.conf" # File name(s), additional files that are added to the repository, the * wildcard is allowed.
+
## BOOTPFILE
## For diskless clients, the image to use for booting.
#BOOTPFILE="/pxelinux.0"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|