ipk CONTROL 目录的作用

CONTROL文件夹下的文件意义
preinst        - shell script,在ipk包开始安装前执行;
postinst       - shell script,在ipk包安装后执行; 
prerm           - 在ipk包 remove前执行; 
postrm         - 在ipk包 remove后执行; 

例如,在openwrt中要加入一个test-hello包,在test-hello.ipk安装前,需要执行特定的操作,那么就需要用到preinst。

那么,怎么加入指定的脚本呢?

需要在Makefile中加入如下内容(仅是示例)

define Package/$(PKG_NAME)/preinst

#!/bin/sh

echo "test-hello preinst"

exit 0

endef

注意:如果脚本执行完毕要取消安装过程,直接让它返回false,即preinst 中exit 1。

原文地址:https://www.cnblogs.com/black-mamba/p/8717487.html