few fixes

This commit is contained in:
belliash 2012-01-04 14:02:36 +01:00
parent 6334a06a11
commit c5c336198c
2 changed files with 28 additions and 19 deletions

43
ezsync
View File

@ -15,36 +15,25 @@ source ${EZROOT}/libraries/common
loadLibraries loadLibraries
loadConfiguration loadConfiguration
# 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
# Print EzBuild notice and parse arguments # Print EzBuild notice and parse arguments
printNotice printNotice
until [[ -z "${1}" ]]; do until [[ -z "${1}" ]]; do
case "${1}" in case "${1}" in
-c|--cleanlog) -c|--cleanlog)
printInfo "Clearing log files..." EZOPT_CLEANLOG=true
cleanLog
;; ;;
-h|--help) -h|--help)
showEzsyncUsage showEzsyncUsage
;; ;;
-p|--purge) -p|--purge)
printInfo "Clearing temp directory..." EZOPT_PURGETMP=true
cleanTemp
;; ;;
-P|--purgeonly) -P|--purgeonly)
printInfo "Clearing temp directory..." EZOPT_PURGETMP=true
cleanTemp EZOPT_PURGEONLY=true
quit
;; ;;
-s|--syscheck) -s|--syscheck)
EZOPT_SYSCHECKONLY=1 EZOPT_SYSCHECKONLY=true
;; ;;
*) *)
die "Unrecognized option ${1}" die "Unrecognized option ${1}"
@ -56,8 +45,28 @@ done
# Check system requirements # Check system requirements
printInfo "Checking system prerequisites..." printInfo "Checking system prerequisites..."
checkPrerequisites checkPrerequisites
[ ${?} -ne 0 ] && die "Your environment does not meet EzBuild requirements!" [ ${?} -ne 0 ] && die "Your environment does not meet EzBuild requirements!" 1
if isEnabled ${EZOPT_SYSCHECKONLY}; then if isEnabled ${EZOPT_SYSCHECKONLY}; then
printInfo "Your system meets all EzBuild requirements!" printInfo "Your system meets all EzBuild requirements!"
quit quit
fi fi
# 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
# Optionally purge temp directory or log file only
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

View File

@ -262,8 +262,8 @@ function showEzsyncUsage() {
echo -e "\tEzSync is a part of EzBuild release building metatool used by" echo -e "\tEzSync is a part of EzBuild release building metatool used by"
echo -e "\treGen2 Linux for synchronizing Portage Tree with mainline.\n" echo -e "\treGen2 Linux for synchronizing Portage Tree with mainline.\n"
echo -e "USAGE: ezsync [parameters]" echo -e "USAGE: ezsync [parameters]"
echo -e " -c\t--cleanlog\tclears log file" echo -e " -c\t--cleanlog\tclears log file; not working with -p and -P"
echo -e " -h\t--help\t\tdisplays this screen" echo -e " -h\t--help\t\tdisplays this screen and exits immediately"
echo -e " -p\t--purge\t\tclears temporary folder" echo -e " -p\t--purge\t\tclears temporary folder"
echo -e " -P\t--purgeonly\tclears temporary folder and exits" echo -e " -P\t--purgeonly\tclears temporary folder and exits"
echo -e " -s\t--syscheck\tperforms prerequisites check only" echo -e " -s\t--syscheck\tperforms prerequisites check only"