未分类 - XiZi's Blog
QEMU For Winidows 一句话的事
一句话的是,弄得我搞了几天。结搞:
// include/block/coroutine_int.h
CoroutineAction qemu_coroutine_switch(Coroutine *from, Coroutine *to,
CoroutineAction action) __attribute__((optimize("-O1")));//关键是__attribute__
QEMU Service on Centos
1.先放个配置文件上来
# /etc/qemu.conf
# VMs that should be started on boot
# use the ! prefix to disable starting/stopping a VM
# QEMU_MACHINES=(kms)
QEMU_MACHINES=(kms)
# NOTE: following options will be prepended to qemu_${vm}
# -name ${vm} -pidfile /var/run/qemu/${vm}.pid -daemonize -nographic
qemu_kms_type="system-x86_64"
qemu_kms="-enable-kvm -hda /opt/qemu/kmsm4WOen.rom \
-smbios type=1,manufacturer=Intel,version=1.01234,uuid=564d81c6-cd3a-d8e4-db29-756df139acb9 \
-uuid 564d81c6-cd3a-d8e4-db29-756df139acb9 \
-net nic -net user,hostfwd=tcp::1688-:1688 \
-m 256 -rtc base=localtime,clock=host -M pc \
-monitor telnet:localhost:7100,server,nowait,nodelay"
qemu_kms_haltcmd="echo 'system_powerdown' | nc localhost 7100" # or netcat/ncat
2.服务所需文件。
#!/bin/sh
# /etc/init.d/qemu
. /etc/rc.d/init.d/functions
[ -f /etc/qemu.conf ] && source /etc/qemu.conf
piddir=/var/run/qemu
lock='/var/lock/subsys/qemu-1.5rc1'
QEMU_PATH=/opt/qemu/qemu-1.5rc1
QEMU_DEFAULT_FLAGS='-name ${vm} -pidfile ${piddir}/${vm}.pid -daemonize -vga none -display none'
# -nographic
QEMU_HALTCMD_WAIT=30
case "$1" in
start)
[ -d "${piddir}" ] || mkdir -p "${piddir}"
if [ -f $lock ]; then
# we were not shut down correctly
for pidf in `/bin/ls $piddir/*.pid 2>/dev/null`; do
if [ -s $pidf ]; then
kill `cat $pidf` >/dev/null 2>&1
fi
rm -f $pidf
done
rm -f $lock
sleep 2
fi
rm -f $piddir/*.pid
errors=0
sucesses=0
for vm in "${QEMU_MACHINES[@]}"; do
if [ "${vm}" = "${vm#!}" ]; then
echo -n $"Starting QEMU VM: ${vm}"
eval vm_cmdline="\$qemu_${vm}"
eval vm_type="\$qemu_${vm}_type"
if [ -n "${vm_type}" ]; then
vm_cmd="${QEMU_PATH}/bin/qemu-${vm_type}"
else
vm_cmd="${QEMU_PATH}/bin/qemu"
fi
eval "qemu_flags=\"${QEMU_DEFAULT_FLAGS}\""
${vm_cmd} ${qemu_flags} ${vm_cmdline} >/dev/null
if [ $? = 0 ]; then
successes=1
else
errors=1
fi
fi
done
if [ $errors = 1 ]; then
failure; echo
else
success; echo
fi
if [ $successes = 1 ]; then
touch $lock
fi
;;
stop)
for vm in "${QEMU_MACHINES[@]}"; do
if [ "${vm}" = "${vm#!}" ]; then
# check pidfile presence and permissions
if [ ! -r "${piddir}/${vm}.pid" ]; then
continue
fi
echo -n $"Stopping QEMU VM: ${vm}"
eval vm_haltcmd="\$qemu_${vm}_haltcmd"
eval vm_haltcmd_wait="\$qemu_${vm}_haltcmd_wait"
vm_haltcmd_wait=${vm_haltcmd_wait:-${QEMU_HALTCMD_WAIT}}
vm_pid=$(cat ${piddir}/${vm}.pid)
# check process existence
if ! kill -0 ${vm_pid} 2>/dev/null; then
stat_done
rm -f "${piddir}/${vm}.pid"
continue
fi
# Try to shutdown VM safely
_vm_running='yes'
if [ -n "${vm_haltcmd}" ]; then
eval ${vm_haltcmd} >/dev/null
_w=0
while [ "${_w}" -lt "${vm_haltcmd_wait}" ]; do
sleep 1
if ! kill -0 ${vm_pid} 2>/dev/null; then
# no such process
_vm_running=''
break
fi
_w=$((_w + 1))
done
else
# No haltcmd - kill VM unsafely
_vm_running='yes'
fi
if [ -n "${_vm_running}" ]; then
# kill VM unsafely
kill ${vm_pid} 2>/dev/null
sleep 1
fi
# report status
if kill -0 ${vm_pid} 2>/dev/null; then
# VM is still alive
#kill -9 ${vm_pid}
failure; echo
else
success; echo
fi
# remove pidfile
rm -f "${piddir}/${vm}.pid"
fi
done
rm -f $lock
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
PS:
# 如果你没安装过nc的话,就yum一下要么nc用不了,无法关闭服务器。 # yum install -y nc
SAMBA在CentOS6上出现NT_STATUS_ACCESS_DENIED错误的解决方法
Build NetCDF For C,C++,Fortran interface with intel comilers
由于版本的变化,导致了NetCDF的一些变化。因此,此过程仅适用于NetCDF的版本为4.1.3(估计适用于3.6.3-4.1.3),但不适用于后来的4.2版本。
1、解压源程序包,修改configure文件
--- netcdf-4.1.3/configure 2011-07-01 07:22:45.000000000 +0800
+++ netcdf-4.1.3n/configure 2013-04-19 05:39:43.029982048 +0800
@@ -24472,7 +24472,7 @@
call sub()
end
EOF
- doit='$FC -c ${FFLAGS} conftest.f'
+ doit='$FC -c conftest.f'
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$doit\""; } >&5
(eval $doit) 2>&5
ac_status=$?
2、configure and install
./configure --disable-netcdf-4 --disable-dap --prefix=/opt/netcdf \ CPP='icc -E' CXXCPP='icpc -E' CC=icc CXX=icpc FC=ifort F90=ifort F77=ifort \ CFLAGS="-fast -w" CXXFLAGS="-fast -w" FFLAGS="-fast -w" LD=ifort \ LFLAGS="-fast -w" AR=xiar CPPFLAGS='-DNDEBUG -DINTEL_COMPILER' make install
PS: 如果在Centos下configure失败,请安装依赖库。
yum install glibc-devel glibc-headers glibc-static
goagent linux service script
#!/bin/bash
#
# file /etc/init.d/goagentd
# goagentd Start up the goagentd server daemon
#
# chkconfig: 2345 55 25
# description: goagentd
#
# processname: proxy.py
# pidfile: /var/run/goagentd.pid
### BEGIN INIT INFO
# Provides: goagentd
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
# Should-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: GoAgent
# Description: GoAgent GAE Proxy Server.
### END INIT INFO
# source function library
. /etc/rc.d/init.d/functions
prog="goagent"
PYTHON=python
proxy=/opt/goagent/local/proxy.py
log=/opt/goagent/local/log
runlevel=$(set -- $(runlevel); eval "echo \$$#" )
start()
{
echo -n $"Starting $prog: "
[ -f "$log" ] && mv -f "$log" "$log.old"
$PYTHON $proxy 1>&$log 2>&1 &
touch /var/lock/subsys/goagent
}
stop()
{
echo -n $"Stopping $prog: "
kill $(ps aux | grep "[p]ython $proxy" | awk '{print $2}')
rm -f /var/lock/subsys/goagent
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
esac
exit 0
Word 脚注跨页的处理
A: 尝试设置:格式\段落\换行和分页选中其中"孤行控制"和"段中不分页"试试。
Linux 技巧:让进程在后台可靠运行的几种方法
[转自IBM]http://www.ibm.com/developerworks/cn/linux/l-cn-nohup/
我们经常会碰到这样的问题,用 telnet/ssh 登录了远程的 Linux 服务器,运行了一些耗时较长的任务, 结果却由于网络的不稳定导致任务中途失败。如何让命令提交后不受本地关闭终端窗口/网络断开连接的干扰呢?下面举了一些例子, 您可以针对不同的场景选择不同的方式来处理这个问题。
如果只是临时有一个命令需要长时间运行,什么方法能最简便的保证它在后台稳定运行呢?
我们知道,当用户注销(logout)或者网络断开时,终端会收到 HUP(hangup)信号从而关闭其所有子进程。因此,我们的解决办法就有两种途径:要么让进程忽略 HUP 信号,要么让进程运行在新的会话里从而成为不属于此终端的子进程。
1. nohup
nohup 无疑是我们首先想到的办法。顾名思义,nohup 的用途就是让提交的命令忽略 hangup 信号。让我们先来看一下 nohup 的帮助信息:
NOHUP(1) User Commands NOHUP(1)
NAME
nohup - run a command immune to hangups, with output to a non-tty
SYNOPSIS
nohup COMMAND [ARG]...
nohup OPTION
DESCRIPTION
Run COMMAND, ignoring hangup signals.
--help display this help and exit
--version
output version information and exit
|
可见,nohup 的使用是十分方便的,只需在要处理的命令前加上 nohup 即可,标准输出和标准错误缺省会被重定向到 nohup.out 文件中。一般我们可在结尾加上"&"来将命令同时放入后台运行,也可用">filename 2>&1"来更改缺省的重定向文件名。
[root@pvcent107 ~]# nohup ping www.ibm.com &
[1] 3059
nohup: appending output to `nohup.out'
[root@pvcent107 ~]# ps -ef |grep 3059
root 3059 984 0 21:06 pts/3 00:00:00 ping www.ibm.com
root 3067 984 0 21:06 pts/3 00:00:00 grep 3059
[root@pvcent107 ~]#
|
2。setsid
nohup 无疑能通过忽略 HUP 信号来使我们的进程避免中途被中断,但如果我们换个角度思考,如果我们的进程不属于接受 HUP 信号的终端的子进程,那么自然也就不会受到 HUP 信号的影响了。setsid 就能帮助我们做到这一点。让我们先来看一下 setsid 的帮助信息:
SETSID(8) Linux Programmer’s Manual SETSID(8)
NAME
setsid - run a program in a new session
SYNOPSIS
setsid program [ arg ... ]
DESCRIPTION
setsid runs a program in a new session.
|
可见 setsid 的使用也是非常方便的,也只需在要处理的命令前加上 setsid 即可。
[root@pvcent107 ~]# setsid ping www.ibm.com
[root@pvcent107 ~]# ps -ef |grep www.ibm.com
root 31094 1 0 07:28 ? 00:00:00 ping www.ibm.com
root 31102 29217 0 07:29 pts/4 00:00:00 grep www.ibm.com
[root@pvcent107 ~]#
|
值得注意的是,上例中我们的进程 ID(PID)为31094,而它的父 ID(PPID)为1(即为 init 进程 ID),并不是当前终端的进程 ID。请将此例与nohup 例中的父 ID 做比较。
3。&
这里还有一个关于 subshell 的小技巧。我们知道,将一个或多个命名包含在“()”中就能让这些命令在子 shell 中运行中,从而扩展出很多有趣的功能,我们现在要讨论的就是其中之一。
当我们将"&"也放入“()”内之后,我们就会发现所提交的作业并不在作业列表中,也就是说,是无法通过jobs来查看的。让我们来看看为什么这样就能躲过 HUP 信号的影响吧。
[root@pvcent107 ~]# (ping www.ibm.com &)
[root@pvcent107 ~]# ps -ef |grep www.ibm.com
root 16270 1 0 14:13 pts/4 00:00:00 ping www.ibm.com
root 16278 15362 0 14:13 pts/4 00:00:00 grep www.ibm.com
[root@pvcent107 ~]#
|
从上例中可以看出,新提交的进程的父 ID(PPID)为1(init 进程的 PID),并不是当前终端的进程 ID。因此并不属于当前终端的子进程,从而也就不会受到当前终端的 HUP 信号的影响了。
我们已经知道,如果事先在命令前加上 nohup 或者 setsid 就可以避免 HUP 信号的影响。但是如果我们未加任何处理就已经提交了命令,该如何补救才能让它避免 HUP 信号的影响呢?
这时想加 nohup 或者 setsid 已经为时已晚,只能通过作业调度和 disown 来解决这个问题了。让我们来看一下 disown 的帮助信息:
disown [-ar] [-h] [jobspec ...] Without options, each jobspec is removed from the table of active jobs. If the -h option is given, each jobspec is not removed from the table, but is marked so that SIGHUP is not sent to the job if the shell receives a SIGHUP. If no jobspec is present, and neither the -a nor the -r option is supplied, the current job is used. If no jobspec is supplied, the -a option means to remove or mark all jobs; the -r option without a jobspec argument restricts operation to running jobs. The return value is 0 unless a jobspec does not specify a valid job. |
可以看出,我们可以用如下方式来达成我们的目的。
-
用
disown -h jobspec来使某个作业忽略HUP信号。 -
用
disown -ah来使所有的作业都忽略HUP信号。 -
用
disown -rh来使正在运行的作业忽略HUP信号。
需要注意的是,当使用过 disown 之后,会将把目标作业从作业列表中移除,我们将不能再使用jobs来查看它,但是依然能够用ps -ef查找到它。
但是还有一个问题,这种方法的操作对象是作业,如果我们在运行命令时在结尾加了"&"来使它成为一个作业并在后台运行,那么就万事大吉了,我们可以通过jobs命令来得到所有作业的列表。但是如果并没有把当前命令作为作业来运行,如何才能得到它的作业号呢?答案就是用 CTRL-z(按住Ctrl键的同时按住z键)了!
CTRL-z 的用途就是将当前进程挂起(Suspend),然后我们就可以用jobs命令来查询它的作业号,再用bg jobspec 来将它放入后台并继续运行。需要注意的是,如果挂起会影响当前进程的运行结果,请慎用此方法。
disown 示例1(如果提交命令时已经用“&”将命令放入后台运行,则可以直接使用“disown”)
[root@pvcent107 build]# cp -r testLargeFile largeFile &
[1] 4825
[root@pvcent107 build]# jobs
[1]+ Running cp -i -r testLargeFile largeFile &
[root@pvcent107 build]# disown -h %1
[root@pvcent107 build]# ps -ef |grep largeFile
root 4825 968 1 09:46 pts/4 00:00:00 cp -i -r testLargeFile largeFile
root 4853 968 0 09:46 pts/4 00:00:00 grep largeFile
[root@pvcent107 build]# logout
|
disown 示例2(如果提交命令时未使用“&”将命令放入后台运行,可使用 CTRL-z 和“bg”将其放入后台,再使用“disown”)
[root@pvcent107 build]# cp -r testLargeFile largeFile2
[1]+ Stopped cp -i -r testLargeFile largeFile2
[root@pvcent107 build]# bg %1
[1]+ cp -i -r testLargeFile largeFile2 &
[root@pvcent107 build]# jobs
[1]+ Running cp -i -r testLargeFile largeFile2 &
[root@pvcent107 build]# disown -h %1
[root@pvcent107 build]# ps -ef |grep largeFile2
root 5790 5577 1 10:04 pts/3 00:00:00 cp -i -r testLargeFile largeFile2
root 5824 5577 0 10:05 pts/3 00:00:00 grep largeFile2
[root@pvcent107 build]#
|
我们已经知道了如何让进程免受 HUP 信号的影响,但是如果有大量这种命令需要在稳定的后台里运行,如何避免对每条命令都做这样的操作呢?
此时最方便的方法就是 screen 了。简单的说,screen 提供了 ANSI/VT100 的终端模拟器,使它能够在一个真实终端下运行多个全屏的伪终端。screen 的参数很多,具有很强大的功能,我们在此仅介绍其常用功能以及简要分析一下为什么使用 screen 能够避免 HUP 信号的影响。我们先看一下 screen 的帮助信息:
SCREEN(1) SCREEN(1)
NAME
screen - screen manager with VT100/ANSI terminal emulation
SYNOPSIS
screen [ -options ] [ cmd [ args ] ]
screen -r [[pid.]tty[.host]]
screen -r sessionowner/[[pid.]tty[.host]]
DESCRIPTION
Screen is a full-screen window manager that multiplexes a physical
terminal between several processes (typically interactive shells).
Each virtual terminal provides the functions of a DEC VT100 terminal
and, in addition, several control functions from the ISO 6429 (ECMA
48, ANSI X3.64) and ISO 2022 standards (e.g. insert/delete line and
support for multiple character sets). There is a scrollback history
buffer for each virtual terminal and a copy-and-paste mechanism that
allows moving text regions between windows.
|
使用 screen 很方便,有以下几个常用选项:
-
用
screen -dmS session name来建立一个处于断开模式下的会话(并指定其会话名)。 -
用
screen -list来列出所有会话。 -
用
screen -r session name来重新连接指定会话。 -
用快捷键
CTRL-a d来暂时断开当前会话。
[root@pvcent107 ~]# screen -dmS Urumchi
[root@pvcent107 ~]# screen -list
There is a screen on:
12842.Urumchi (Detached)
1 Socket in /tmp/screens/S-root.
[root@pvcent107 ~]# screen -r Urumchi
|
当我们用“-r”连接到 screen 会话后,我们就可以在这个伪终端里面为所欲为,再也不用担心 HUP 信号会对我们的进程造成影响,也不用给每个命令前都加上“nohup”或者“setsid”了。这是为什么呢?让我来看一下下面两个例子吧。
[root@pvcent107 ~]# ping www.google.com &
[1] 9499
[root@pvcent107 ~]# pstree -H 9499
init─┬─Xvnc
├─acpid
├─atd
├─2*[sendmail]
├─sshd─┬─sshd───bash───pstree
│ └─sshd───bash───ping
|
我们可以看出,未使用 screen 时我们所处的 bash 是 sshd 的子进程,当 ssh 断开连接时,HUP 信号自然会影响到它下面的所有子进程(包括我们新建立的 ping 进程)。
[root@pvcent107 ~]# screen -r Urumchi
[root@pvcent107 ~]# ping www.ibm.com &
[1] 9488
[root@pvcent107 ~]# pstree -H 9488
init─┬─Xvnc
├─acpid
├─atd
├─screen───bash───ping
├─2*[sendmail]
|
而使用了 screen 后就不同了,此时 bash 是 screen 的子进程,而 screen 是 init(PID为1)的子进程。那么当 ssh 断开连接时,HUP 信号自然不会影响到 screen 下面的子进程了。
现在几种方法已经介绍完毕,我们可以根据不同的场景来选择不同的方案。nohup/setsid 无疑是临时需要时最方便的方法,disown 能帮助我们来事后补救当前已经在运行了的作业,而 screen 则是在大批量操作时不二的选择了。
CentOS 修改系统字体
1、添加字体
#创建新的字体存放文件夹 mkdir /usr/share/fonts/chinese #拷贝新字体到新文件夹 cp newfont.ttf /usr/share/fonts/chinese cd /usr/share/fonts/chinese #修复字体字体权限(这里比较重要,否则可能字体访问出错) chmod 644 *.ttf #更新字体 mkfontscale mkfontdir fc-cache -fv
2、配置字体,下面是/etc/fonts/local.conf的一个示例,这里替换字体为微软雅黑
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <match target="pattern"> <test qual="any" name="family"> <string>serif</string> </test> <edit name="family" mode="prepend" binding="strong"> <string>DejaVu Serif</string> <string>YaHei Consolas Hybrid</string> <string>AR PL UMing CN</string> <string>AR PL ShanHeiSun Uni</string> <string>WenQuanYi Bitmap Song</string> <string>Bitstream Vera Serif</string> <string>AR PL UKai CN</string> <string>AR PL ZenKai Uni</string> </edit> </match> <match target="pattern"> <test qual="any" name="family"> <string>sans-serif</string> </test> <edit name="family" mode="prepend" binding="strong"> <string>DejaVu Sans</string> <string>YaHei Consolas Hybrid</string> <string>Bitstream Vera Sans</string> <string>WenQuanYi Zen Hei</string> <string>AR PL UMing CN</string> <string>AR PL ShanHeiSun Uni</string> <string>WenQuanYi Bitmap Song</string> <string>AR PL UKai CN</string> <string>AR PL ZenKai Uni</string> </edit> </match> <match target="pattern"> <test qual="any" name="family"> <string>monospace</string> </test> <edit name="family" mode="prepend" binding="strong"> <string>DejaVu Sans Mono</string> <string>YaHei Consolas Hybrid</string> <string>Bitstream Vera Sans Mono</string> <string>WenQuanYi Zen Hei</string> <string>AR PL UMing CN</string> <string>AR PL ShanHeiSun Uni</string> <string>WenQuanYi Bitmap Song</string> <string>AR PL UKai CN</string> <string>AR PL ZenKai Uni</string> </edit> </match> </fontconfig>
修改Mac安装盘,直接运行OSInstall.mpkg安装系统,到第二分区。
1、主要修改OSInstall.mpkg和BaseSystemResources.pkg两个文件(位于目录:System/Installation/Packages下面)。
2、修改OSInstall.mpkg,主要取消一些安装包没有但是在Distribution文件里面默认配置了,所以安装的时候提示出错。步骤如下
# 1. 创建OSInstall文件夹,并解压mpkg文件. 在这之前可能需要sudo获取root权限。
mkdir OSInstall
cd OSInstall
xar -x -f ../OSInstall.mpkg
# 2. 用你喜欢的文本编辑器编辑Distribution文件,主要修改4个地方
####(1)删除 eraseOptionAvailable="true" 是目标可以安装在MBR分区
@@ -1,6 +1,6 @@
<?xml version="1.0" standalone="yes"?>
<installer-gui-script minSpecVersion="1">
- <options eraseOptionAvailable="true" hostArchitectures="i386" allow-external-scripts="yes"/>
+ <options hostArchitectures="i386" allow-external-scripts="yes"/>
<title>MacOSX_Title</title>
<license file="License.rtf"/>
<conclusion file="Conclusion.rtfd"/>
#### (2) 修改isSupportedPlatform函数直接返回true
@@ -41,23 +41,7 @@
function isSupportedPlatform(){
- if( isVirtualMachine() ){
- return true;
- }
-
- var platformSupportValues=["Mac-F2268DC8","Mac-F22C86C8","Mac-F22587C8","Mac-F2218FA9","Mac-F2218EA9","Mac-F42D86A9","Mac-F22C8AC8","Mac-F22586C8","Mac-942B59F58194171B","Mac-F226BEC8","Mac-F4218FC8","Mac-942459F5819B171B","Mac-7BA5B2794B2CDB12","Mac-F4218EC8","Mac-F2208EC8","Mac-F22C89C8","Mac-F22587A1","Mac-F221DCC8","Mac-F42388C8","Mac-F223BEC8","Mac-F4238CC8","Mac-F222BEC8","Mac-F227BEC8","Mac-F4208AC8","Mac-F22788A9","Mac-F4238BC8","Mac-F221BEC8","Mac-C08A6BB70A942AC2","Mac-8ED6AF5B48C039E1","Mac-F2238AC8","Mac-F4208EAA","Mac-F22788C8","Mac-F2268EC8","Mac-F2218EC8","Mac-F22589C8","Mac-F4228EC8","Mac-F22788AA","Mac-F42C86C8","Mac-F4208CA9","Mac-942C5DF58193131B","Mac-F2238BAE","Mac-F42289C8","Mac-F2268CC8","Mac-F4208DC8","Mac-F2218FC8","Mac-742912EFDBEE19B3","Mac-F4208DA9","Mac-F42D89C8","Mac-F4208CAA","Mac-F42D89A9","Mac-F2268AC8","Mac-F42C89C8","Mac-942452F5819B1C1B","Mac-F42786A9","Mac-F42D88C8","Mac-F42187C8","Mac-94245B3640C91C81","Mac-F42D86C8","Mac-4BC72D62AD45599E","Mac-F2268DAE","Mac-F42C8CC8","Mac-F42C88C8","Mac-94245A3940C91C80","Mac-F42386C8","Mac-942B5BF58194151B","Mac-F42189C8"];
- var boardID = system.ioregistry.fromPath('IOService:/')['board-id'];
-
- if( !boardID || platformSupportValues.length ==0 ) {
- return false
- }
- for( var i = 0; i < platformSupportValues.length; i++ ){
- if( boardID == platformSupportValues[i] ){
- return true;
- }
- }
-
- return false;
+ return true;
}
####(3)检查是否为Server版本系统
@@ -170,19 +154,9 @@
return false;
}
- // Media Snag Boot
- } else if (system.env.__OSINSTALL_ENVIRONMENT == '1' && system.files.fileExistsAtPath("/System/Installation/Packages/OSInstall.mpkg")) {
-
- // Only allow install on server volumes if Server.app is installed
- if (! system.files.bundleAtPath(my.target.mountpoint + "/Applications/Server.app")) {
-
- my.result.message = system.localizedString('VC_NeedServerApp_message');
- my.result.type = 'Fatal';
- return false;
- }
// Recovery HD
- } else if (system.env.__OSINSTALL_ENVIRONMENT == '1' && ! system.files.fileExistsAtPath("/System/Installation/Packages/OSInstall.mpkg")) {
+ } else if (! system.files.fileExistsAtPath("/System/Installation/Packages/OSInstall.mpkg")) {
// Block Server volumes
my.result.message = system.localizedString('VC_CannotUpgradeServerRecovery_message');
####(4)去掉没有的语言包制定
@@ -596,16 +543,6 @@
<pkg-ref id="com.apple.MacOSX.lang.tr" auth="root">Turkish.pkg</pkg-ref>
<pkg-ref id="com.apple.MacOSX.lang.cs" auth="root">Czech.pkg</pkg-ref>
<pkg-ref id="com.apple.pkg.ServerEssentials" auth="root">ServerEssentials.pkg</pkg-ref>
- <pkg-ref id="com.apple.MacOSX.lang.th" auth="root">Thai.pkg</pkg-ref>
- <pkg-ref id="com.apple.MacOSX.lang.ca" auth="root">Catalan.pkg</pkg-ref>
- <pkg-ref id="com.apple.MacOSX.lang.hr" auth="root">Croatian.pkg</pkg-ref>
- <pkg-ref id="com.apple.MacOSX.lang.el" auth="root">Greek.pkg</pkg-ref>
- <pkg-ref id="com.apple.MacOSX.lang.he" auth="root">Hebrew.pkg</pkg-ref>
- <pkg-ref id="com.apple.MacOSX.lang.ro" auth="root">Romanian.pkg</pkg-ref>
- <pkg-ref id="com.apple.MacOSX.lang.sk" auth="root">Slovak.pkg</pkg-ref>
- <pkg-ref id="com.apple.MacOSX.lang.uk" auth="root">Ukrainian.pkg</pkg-ref>
- <pkg-ref id="com.apple.mpkg.OSInstall" auth="root" version="10.7.0">OSInstall.mpkg</pkg-ref>
- <system-image id="com.apple.dmg.MacOSX">BaseSystem.dmg</system-image>
<pkg-ref id="com.apple.MacOSX.lang.ar" installKBytes="50124" version="10.7.0.1.1.1306847324"/>
<pkg-ref id="com.apple.MacOSX.lang.ca" installKBytes="75279" version="10.7.0.1.1.1306847324"/>
<pkg-ref id="com.apple.MacOSX.lang.cs" installKBytes="42768" version="10.7.0.1.1.1306847324"/>
#3. 重新打包OSInstall.mpkg
xar -c -f ../OSInstall.mpkg *
3. 修改BaseSystemResources.pkg
# 1. 创建BaseSystemResources文件夹,并解压mpkg文件. 在这之前可能需要sudo获取root权限。 mkdir BaseSystemResources cd BaseSystemResources xar -x -f ../BaseSystemResources.pkg # 2. 创建Payload文件 touch Payload # 3. 重新打包 xar -c -f ../BaseSystemResources.pkg *
利用openssl完成X509证书和PFX证书之间的互转
|
完成两种格式的数字证书的互转,只需要几条openssl的命令,很方便。 1.将X509格式的数字证书转换成微软的PFX格式 openssl pkcs12 -export -inkey server.key -in server.crt -out server.pfx
2.将微软的PFX数字证书转换成X509格式
openssl pkcs12 -in server.pfx -nodes -out server.pem # 生成明文所有内容 openssl rsa -in server.pem -out server.key # 取 key 文件 openssl x509 -in server.pem -out server.crt # 取证书 |