ezbuild/ezsync

77 lines
1.7 KiB
Plaintext
Raw Normal View History

2012-01-03 14:49:17 +01:00
#!/bin/bash
# Copyright 2010-2012, Asio Software Technologies
# Distributed under the terms of the GNU General Public License v3
# Declare basic system variables
EZNAME=$(basename ${0})
EZROOT=$(dirname $(readlink -ne ${0}))
# Load necessary files
source /etc/profile
source ${EZROOT}/libraries/common
# Load EzBuild libraries & configuration
loadLibraries
loadConfiguration
# Print EzBuild notice and parse arguments
printNotice
2012-01-04 01:28:10 +01:00
until [[ -z "${1}" ]]; do
case "${1}" in
-c|--cleanlog)
2012-01-04 14:02:36 +01:00
EZOPT_CLEANLOG=true
2012-01-04 01:28:10 +01:00
;;
-h|--help)
2012-01-04 11:38:55 +01:00
showEzsyncUsage
2012-01-04 01:28:10 +01:00
;;
-p|--purge)
2012-01-04 14:02:36 +01:00
EZOPT_PURGETMP=true
2012-01-04 01:28:10 +01:00
;;
-P|--purgeonly)
2012-01-04 14:02:36 +01:00
EZOPT_PURGETMP=true
EZOPT_PURGEONLY=true
2012-01-04 01:28:10 +01:00
;;
-s|--syscheck)
2012-01-04 14:02:36 +01:00
EZOPT_SYSCHECKONLY=true
2012-01-04 01:28:10 +01:00
;;
*)
die "Unrecognized option ${1}"
;;
esac
shift
done
2012-01-03 14:49:17 +01:00
# Check system requirements
printInfo "Checking system prerequisites..."
checkPrerequisites
2012-01-04 14:02:36 +01:00
[ ${?} -ne 0 ] && die "Your environment does not meet EzBuild requirements!" 1
2012-01-04 01:28:10 +01:00
if isEnabled ${EZOPT_SYSCHECKONLY}; then
printInfo "Your system meets all EzBuild requirements!"
quit
fi
2012-01-04 14:02:36 +01:00
# Do not allow more than one working copy
PID=$(pidof -s -o '%PPID' -x ${EZNAME})
if [ ${PID} ]; then
printWarn "The ${EZNAME} is already working with PID: ${PID}"
printWarn "You cannot have more than one instancy running"
exit 0
fi
2012-01-04 14:05:45 +01:00
# Optionally purge whole temp directory or log file only
2012-01-04 14:02:36 +01:00
if isEnabled ${EZOPT_PURGETMP}; then
printInfo "Clearing temp directory..."
cleanTemp
if isEnabled ${EZOPT_PURGEONLY}; then
quit
fi
elif isEnabled ${EZOPT_CLEANLOG}; then
printInfo "Clearing log file..."
cleanLog
fi
2012-01-06 12:23:39 +01:00
# Create all necessary directories
makeCoreDirectories
[ ${?} -ne 0 ] && die "EzBuild was unable to create all necessary directories!" 1