Merge pull request #69 from pigmonkey/backup-freebsd
Support FreeBSD date utility
This commit is contained in:
		
						commit
						a08d43ce7b
					
				@ -82,7 +82,8 @@ get_date_binary() {
 | 
				
			|||||||
  #$(uname) on OS X defaults to $(uname -s) and $(uname) on GNU/Linux defaults to $(uname -s)
 | 
					  #$(uname) on OS X defaults to $(uname -s) and $(uname) on GNU/Linux defaults to $(uname -s)
 | 
				
			||||||
  uname_result=$(uname)
 | 
					  uname_result=$(uname)
 | 
				
			||||||
  case $uname_result in
 | 
					  case $uname_result in
 | 
				
			||||||
    Darwin) date_binary="osx-posix" ;;
 | 
					    Darwin) date_binary="posix" ;;
 | 
				
			||||||
 | 
					    FreeBSD) date_binary="posix" ;;
 | 
				
			||||||
    Linux) date_binary="linux-gnu" ;;
 | 
					    Linux) date_binary="linux-gnu" ;;
 | 
				
			||||||
    *) date_binary="unknown" ;;
 | 
					    *) date_binary="unknown" ;;
 | 
				
			||||||
  esac
 | 
					  esac
 | 
				
			||||||
@ -102,7 +103,7 @@ esac
 | 
				
			|||||||
#based on the date_binary variable, the case statement below will determine the method to use to determine "purge_after_days" in the future
 | 
					#based on the date_binary variable, the case statement below will determine the method to use to determine "purge_after_days" in the future
 | 
				
			||||||
case $date_binary in
 | 
					case $date_binary in
 | 
				
			||||||
  linux-gnu) echo $(date -d +${purge_after_value_seconds}sec -u +%s) ;;
 | 
					  linux-gnu) echo $(date -d +${purge_after_value_seconds}sec -u +%s) ;;
 | 
				
			||||||
  osx-posix) echo $(date -v +${purge_after_value_seconds}S -u +%s) ;;
 | 
					  posix) echo $(date -v +${purge_after_value_seconds}S -u +%s) ;;
 | 
				
			||||||
  *) echo $(date -d +${purge_after_value_seconds}sec -u +%s) ;;
 | 
					  *) echo $(date -d +${purge_after_value_seconds}sec -u +%s) ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -83,7 +83,8 @@ get_date_binary() {
 | 
				
			|||||||
  #$(uname) on OS X defaults to $(uname -s) and $(uname) on GNU/Linux defaults to $(uname -s)
 | 
					  #$(uname) on OS X defaults to $(uname -s) and $(uname) on GNU/Linux defaults to $(uname -s)
 | 
				
			||||||
  uname_result=$(uname)
 | 
					  uname_result=$(uname)
 | 
				
			||||||
  case $uname_result in
 | 
					  case $uname_result in
 | 
				
			||||||
    Darwin) date_binary="osx-posix" ;;
 | 
					    Darwin) date_binary="posix" ;;
 | 
				
			||||||
 | 
					    FreeBSD) date_binary="posix" ;;
 | 
				
			||||||
    Linux) date_binary="linux-gnu" ;;
 | 
					    Linux) date_binary="linux-gnu" ;;
 | 
				
			||||||
    *) date_binary="unknown" ;;
 | 
					    *) date_binary="unknown" ;;
 | 
				
			||||||
  esac
 | 
					  esac
 | 
				
			||||||
@ -103,7 +104,7 @@ esac
 | 
				
			|||||||
#based on the date_binary variable, the case statement below will determine the method to use to determine "purge_after_days" in the future
 | 
					#based on the date_binary variable, the case statement below will determine the method to use to determine "purge_after_days" in the future
 | 
				
			||||||
case $date_binary in
 | 
					case $date_binary in
 | 
				
			||||||
  linux-gnu) echo $(date -d +${purge_after_value_seconds}sec -u +%s) ;;
 | 
					  linux-gnu) echo $(date -d +${purge_after_value_seconds}sec -u +%s) ;;
 | 
				
			||||||
  osx-posix) echo $(date -v +${purge_after_value_seconds}S -u +%s) ;;
 | 
					  posix) echo $(date -v +${purge_after_value_seconds}S -u +%s) ;;
 | 
				
			||||||
  *) echo $(date -d +${purge_after_value_seconds}sec -u +%s) ;;
 | 
					  *) echo $(date -d +${purge_after_value_seconds}sec -u +%s) ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user