问题:
I'm studying the content of this preinst file that the script executes before that package is unpacked from its Debian archive (.deb) file. 我正在研究脚本在从Debian存档(.deb)文件解压缩该包之前执行的这个preinst文件的内容。
The script has the following code: 该脚本具有以下代码:
#!/bin/bash
set -e
# Automatically added by dh_installinit
if [ "$1" = install ]; then
if [ -d /usr/share/MyApplicationName ]; then
echo "MyApplicationName is just installed"
return 1
fi
rm -Rf $HOME/.config/nautilus-actions/nautilus-actions.conf
rm -Rf $HOME/.local/share/file-manager/actions/*
fi
# End automatically added section
My first query is about the line: 我的第一个问题是关于这一行:
set -e
I think that the rest of the script is pretty simple: It checks whether the Debian/Ubuntu package manager is executing an install operation. 我认为脚本的其余部分非常简单:它检查Debian / Ubuntu包管理器是否正在执行安装操作。 If it is, it checks whether my application has just been installed on the system. 如果是,它会检查我的应用程序是否刚刚安装在系统上。 If it has, the script prints the message "MyApplicationName is just installed" and ends ( return 1 mean that ends with an “error”, doesn't it?). 如果有,脚本将打印消息“MyApplicationName刚刚安装”并结束( return 1表示以“错误”结束,不是吗?)。
If the user is asking the Debian/Ubuntu package system to install my package, the script also deletes two directories. 如果用户要求Debian / Ubuntu软件包系统安装我的软件包,该脚本还会删除两个目录。
Is this right or am I missing something? 这是对的还是我错过了什么?
解决方案:
参考一: https://stackoom.com/question/1KKd4/set-e在bash脚本中的含义是什么参考二: https://oldbug.net/q/1KKd4/What-does-set-e-mean-in-a-bash-script
来源:oschina
链接:https://my.oschina.net/u/4432649/blog/4404680