add ini writer support

This commit is contained in:
Mario Fetka 2013-03-07 21:38:36 +01:00
parent a0e29cb0ac
commit 75adc590d0
3 changed files with 579 additions and 550 deletions

View File

@ -23,6 +23,7 @@ builder_config() {
CMD_zsyncmake="`which zsyncmake`" ; builder_check_error "Command 'zsyncmake' not installed"
CMD_comm="`which comm`" ; builder_check_error "Command 'comm' not installed"
CMD_sha1sum="`which sha1sum`" ; builder_check_error "Command 'sha1sum' not installed"
CMD_iniset="`which ini-set`" ; builder_check_error "Command 'ini-set' (martINI a pypi project) not installed"
# Check temp dir
test -d ${TMP_DIR}
@ -211,6 +212,10 @@ builder_create() {
local var_file=${OUTPUT_DIR}/variable.ins
create_winst_varfile $var_file
# write ini file
local ini_file=${INST_DIR}/CLIENT_DATA/opsi-$PN.ini
write_ini_file $ini_file
# add the new vaiables to all *.ins winst files
for inst_file in `find ${INST_DIR}/CLIENT_DATA -type f -name "*.ins"` ; do
sed -i -e "/@@BUILDER_VARIABLES@@/ {

View File

@ -297,3 +297,27 @@ function calc_release() {
builder_check_error "Cannot incrememnt REV_RELEASE from file ${oldest_cfg}"
fi
}
###################
# Write Package Ini file
#
# Create a ini file containing needed information for package uninstall
#
# Parameter
# file: file to create / modify
#
###################
write_ini_file() {
local ini_file=$1
# publish some other variables
for var in VENDOR PN VERSION RELEASE TYPE CREATOR_TAG CREATOR_NAME CREATOR_EMAIL ; do
$CMD_iniset $ini_file --COMMON ${var}="${!var}"
done
# publish custom variables
for (( i = 0 ; i < ${#OPSI_INI_NAME[@]} ; i++ )) ; do
$CMD_iniset $ini_file --${OPSI_INI_SECTION[$i]} ${OPSI_INI_NAME[$i]}="${OPSI_INI_VALUE[$i]}"
done
}