InstallAnyWhere使用笔记-制作升级补丁时的一些判断
Gmail:chenluqq@gmail.com
现状和需求:目前本版 165
1. window 下有注册表项
2. Linux /opt/XXXX/productinfo.txt (XXXX 产品名 此文件位置是固定的)
3.补丁可以 对 65-69的版本升级到70.
Winodows
1.Get Windows Registry Entry:comment 获取程序的安装路径
Store Value in Variable: $USER_MAGIC_FOLDER_1$
Store Key Existence in Variable:$cs2c_path_bool$
1.Get Windows Registry Entry:comment 获取程序的版本信息 存入 $HaveUp$
3.添加Show message dialog (Add action..Show message dialog) 判断产品是否安装
Dialog Type
Button 0 -3 3个按钮可以选 每个按钮后的 有3个可以选项 Return to Previous Panel (返回上一步) Continut to Next (继续下一步 "忽略") Cancel and Exit (退出)
Rules 里设置此Dialog的显示条件
Add Rule... >>Compare InstallAnywhere Veriables
------------------------------------------------------------------------------------------
Operand 1: Operand 1:
$USER_MAGIC_FOLDER_1$ does not contains NeoShineOffice 5
-----------------------------------------------------------------------------------------
这里其实也可以根据 $cs2c_path_bool$判断 , 但是由于我们的软件有多个系列 注册表位置都写在此处 切别只是安装目录名不同 (如NeoShineOffice 5 、 NeoShineOffice 3)且这个安装过程用户是不可以更改的。
4.添加Show message dialog (Add action..Show message dialog) 判断产品版本
Properties 设置方法和上一步一样
Rules 里设置此Dialog的显示条件 (根据升级策略 安装o退出)
Add Rule... >>Match Regular Expression
------------------------------------------------------------------------------------------
Operand : Regular Expression
$HaveUp$ does not Match 0501.0201.3000.6[5-9]00
-------------------------------------------------------------------------------------------
*注:正则规则 同java
4.添加Show message dialog (Add action..Show message dialog) 判断程序是否正在运行
Add Rule...>>>Check File/Folder Attributes
选中 Perform only if the file/folder is in-use
若有多个条件 请注意 Rules List :logically {or/and} when evaluating multiple rules
5.Post-Install 内修改注册表 更改版本号
Add Action...>>>Exeute Command:
Command Line: reg add "HKLM\software\NeoShine Office" /v Version /t REG_SZ /d 0501.0201.3000.7000 /f
6 Build >>build project
Linux 下的类似windows (权限和版本判断 我都了外部脚本中)
Install
代码
dir=`dirname $0`
cmd="$dir/update.bin"
if [ ${UID} = 0 ]; then
exec $cmd
exit
fi
xsu=`which gksu kdesu 2>&- | head -1`
if [ $xsu ]; then
$xsu $cmd
exit
fi
xterm=`which gnome-terminal terminal konsole xterm rxvt eterm 2>&- | head -1`
if [ -z "$xsu" ]; then
$xterm -e "$dir/textinmod" && exit
fi
textinmod
exec < /opt/neoshineoffice5/productinfo.txt
# 读取 /opt/neoshineoffice5/productinfo.txt 的第6行
for i in {1..6}
do
read line
done
# 判断版本、校验升级
#if [[ ${line:0:4} -eq "0501" ]]
#then
if [[ ${line:15:2} -le "76" && ${line:15:2} -ge "60" ]]
then
echo "当前版本是:1"${line:15:2}" 可以升级."
echo "请按系统提示输入密码"
sudo ./update.bin
echo "升级完成!"
else
echo "当前版本是:1"${line:15:2}" 不可以升级"
echo "此升级补丁 支持 160~170之间的版本升级!"
fi
#fi
sleep 3
InstallAnywhere只是打包了和释放下文件
方块字解决 查看 http://www.cnblogs.com/cpper/archive/2010/05/19/1739507.html