libtool-bundle

来自「读写Smart卡加解密接口的程序」· 代码 · 共 91 行

TXT
91
字号
#!/bin/sh# A shell script to create MacOS X bundles# from files created by GNU libtool.# Incomplete, but works.## $Id: libtool-bundle,v 1.2.2.1 2003/09/24 19:58:29 aet Exp $# <aet@cc.hut.fi>#set -everbose=0verbose_msg (){  if [ $verbose -ne 0 ]; then    echo "libtool-bundle: $@"  fi}error_msg (){  echo 1>&2 "libtool-bundle: $@"}[ $# -le 1 -o $# -ge 4 ] && error_msg "Usage: $0 [Mach-O bundle file] [destination directory] <bundle name>" && exit 1sofile=$1[ ! -f $sofile ] && error_msg "Not a file or file not found: $sofile" && exit 1case "$sofile" in*.so*)  # Assume it's ok  ;;*)  error_msg "Invalid bundle: $sofile"  exit 1  ;;esacdestdir=$2[ ! -d $destdir -o ! -w $destdir ] && error_msg "Not a directory or no write access: $destdir" && exit 1name="$sofile"[ $# -eq 3 ] && name=$3name=`echo $name | sed -e "s@.*/@@" -e "s@\.so.*@@"`root="$destdir/${name}.bundle"verbose_msg "sofile: $sofile"verbose_msg "destdir: $destdir"verbose_msg "name: $name"verbose_msg "root: $root"arch=`uname`[ x$arch = xDarwin ] && arch=MacOStype="BNDL"creator="????"# Overwrite existing bundle[ -d "$root" ] && rm -rf "$root"mkdir -p "$root"/Contents/$archcp "$sofile" "$root"/Contents/$arch/"$name"echo "$type$creator" > "$root"/Contents/PkgInfocreate_info_plist (){  echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"  echo "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"  echo "<plist version=\"1.0\">"  echo "<dict>"  echo "	<key>CFBundleDevelopmentRegion</key>"  echo "	<string>English</string>"  echo "	<key>CFBundleExecutable</key>"  echo "	<string>$name</string>"  echo "	<key>CFBundleInfoDictionaryVersion</key>"  echo "	<string>6.0</string>"  echo "	<key>CFBundleName</key>"  echo "	<string>$name</string>"  echo "	<key>CFBundlePackageType</key>"  echo "	<string>$type</string>"  echo "	<key>CFBundleSignature</key>"  echo "	<string>$creator</string>"  echo "	<key>CFBundleVersion</key>"  echo "	<string>0.0.1d1</string>"  echo "</dict>"  echo "</plist>"}create_info_plist > "$root"/Contents/Info.plistecho "Installed $sofile as $root"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?