61 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
 | |
| source "$(dirname -- "$0")/lib/ulib/auto" || exit 1
 | |
| 
 | |
| function display_help() {
 | |
|     uecho "$scriptname: créer une archive de la distribution WebObjects en cours
 | |
| USAGE
 | |
|     $scriptname [-n name] [-f files]
 | |
| 
 | |
| OPTIONS
 | |
|     -n NAME
 | |
|         Nom de base de l'archive. Par défaut il s'agit de WebObjects-<version>
 | |
| 
 | |
|     -f FILES
 | |
|         Nom de la liste des fichiers de l'archives. Par défaut il s'agit de
 | |
|         \$NAME.files"
 | |
| }
 | |
| 
 | |
| name=
 | |
| files=
 | |
| parse_opts "${PRETTYOPTS[@]}" \
 | |
|     --help '$exit_with display_help' \
 | |
|     -n: name= \
 | |
|     -f: files= \
 | |
|     @ args -- "$@" && set -- "${args[@]}" || die "$args"
 | |
| 
 | |
| check_sysinfos -s macosx || die "Ce script est fait uniquement pour MacOS X"
 | |
| 
 | |
| version="$(grep -A 1 CFBundleShortVersionString /System/Library/Frameworks/JavaWebObjects.framework/Resources/version.plist | tail -1 | sed 's/^.*<string>\(.*\)<\/string>.*$/\1/')"
 | |
| 
 | |
| [ -n "$name" ] || name="WebObjects-$version"
 | |
| [ -n "$files" ] || files="${name}.files"
 | |
| 
 | |
| array_from_lines sfwks "$(ls -d /System/Library/Frameworks/Java*.framework |
 | |
| grep -v '/Java\(VM\|Embedding\|FrameEmbedding\|ScriptCore\).framework$')"
 | |
| array_from_lines private_sfwks "$(ls -d /System/Library/PrivateFrameworks/*.framework |
 | |
| grep '/\(EOPlaceholders\|JavaMonitor\).framework$')"
 | |
| array_from_lines swo "$(ls -d /System/Library/WebObjects)"
 | |
| array_from_lines fwks "$(ls -d /Library/Frameworks/JavaMonitorSupport.framework)"
 | |
| array_from_lines wo "$(ls -d /Library/WebObjects)"
 | |
| array_from_lines ws "$(ls -d /Library/WebServer/Documents/WebObjects)"
 | |
| array_from_lines logs "$(ls -d /Library/Logs/WebObjects)"
 | |
| 
 | |
| etitle "Création de l'archive pour WebObjects $version"
 | |
| echo "# version=$version" >"$files"
 | |
| rm -f "$name.tar"
 | |
| for file in "${sfwks[@]}" "${private_sfwks[@]}" "${swo[@]}" "${fwks[@]}" "${wo[@]}" "${ws[@]}" "${logs[@]}"; do
 | |
|     echo "$file" >>"$files"
 | |
|     ebegin "$file"
 | |
|     tar rf "$name.tar" -C / "${file#/}" &
 | |
|     ewait $!
 | |
|     eend
 | |
| done
 | |
| eend
 | |
| 
 | |
| ebegin "Compression de l'archive"
 | |
| rm -f "$name.tar.gz"
 | |
| gzip "$name.tar" &
 | |
| ewait $!
 | |
| eend
 |