remove opsi and change to 7z create
This commit is contained in:
@@ -11,21 +11,18 @@
|
||||
builder_config() {
|
||||
|
||||
# Define commands
|
||||
CMD_7z="`which 7z`" ; builder_check_error "Command '7z' not installed"
|
||||
CMD_unzip="`which unzip`" ; builder_check_error "Command 'unzip' not installed"
|
||||
CMD_unrar="`which unrar`" ; builder_check_error "Command 'unrar' not installed"
|
||||
CMD_zip="`which zip`" ; builder_check_error "Command 'zip' not installed"
|
||||
CMD_lha="`which lha`" ; builder_check_error "Command 'lha' not installed"
|
||||
CMD_tar="`which tar`" ; builder_check_error "Command 'tar' not installed"
|
||||
CMD_cabextract="`which cabextract`" ; builder_check_error "Command 'cabextract' not installed"
|
||||
CMD_unix2dos="`which unix2dos`" ; builder_check_error "Command 'unix2dos' not installed"
|
||||
CMD_identify="`which identify`" ; builder_check_error "Command 'identify' (ImageMagick) not installed"
|
||||
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"
|
||||
CMD_ruby="`which ruby`" ; builder_check_error "Command 'ruby' not installed"
|
||||
CMD_gpg="`which gpg`" ; builder_check_error "Command 'gpg' not installed"
|
||||
CMD_7z="`which 7z.exe`" ; builder_check_error "Command '7z' not installed"
|
||||
CMD_unzip="`which unzip.exe`" ; builder_check_error "Command 'unzip' not installed"
|
||||
CMD_unrar="`which UnRAR.exe`" ; builder_check_error "Command 'UnRAR' not installed"
|
||||
CMD_zip="`which zip.exe`" ; builder_check_error "Command 'zip' not installed"
|
||||
CMD_lha="`which lha.exe`" ; builder_check_error "Command 'lha' not installed"
|
||||
CMD_tar="`which tar.exe`" ; builder_check_error "Command 'tar' not installed"
|
||||
CMD_cabextract="`which cabextract.exe`" ; builder_check_error "Command 'cabextract' not installed"
|
||||
CMD_unix2dos="`which unix2dos.exe`" ; builder_check_error "Command 'unix2dos' not installed"
|
||||
CMD_sha1sum="`which sha1sum.exe`" ; builder_check_error "Command 'sha1sum' not installed"
|
||||
CMD_inifile="`which inifile.exe`" ; builder_check_error "Command 'inifile' not installed (http://www.horstmuc.de/wbat32d.htm#inifile)"
|
||||
CMD_showver="`which ShowVer.exe`" ; builder_check_error "Command 'ShowVer' not installed (http://www.codeproject.com/Articles/2457/ShowVer-exe-command-line-VERSIONINFO-display-progr)"
|
||||
CMD_tidy="`which tidy.exe`" ; builder_check_error "Command 'tidy' not installed"
|
||||
|
||||
# Check temp dir
|
||||
test -d ${TMP_DIR}
|
||||
@@ -37,14 +34,14 @@ builder_config() {
|
||||
. ${config}
|
||||
|
||||
# set default build configuration and source the user dependent file
|
||||
local config=$BASEDIR/conf/opsi-builder.cfg
|
||||
local config=$BASEDIR/conf/aio-builder.cfg
|
||||
. ${config}
|
||||
|
||||
# Source local build configuration (must be done AFTER sourcing the builder-product.cfg.cfg)
|
||||
if [ -f "$OPSI_BUILDER" ] ; then
|
||||
config=$OPSI_BUILDER
|
||||
if [ -f "$AIO_BUILDER" ] ; then
|
||||
config=$AIO_BUILDER
|
||||
else
|
||||
test -f $HOME/.opsi-builder.cfg && config=$HOME/.opsi-builder.cfg
|
||||
test -f $HOME/.aio-builder.cfg && config=$HOME/.aio-builder.cfg
|
||||
fi
|
||||
|
||||
# Read ONLY the STATUS variable from the build configuration file
|
||||
@@ -57,7 +54,7 @@ builder_config() {
|
||||
. ${config}
|
||||
calc_release
|
||||
else
|
||||
# OPSI/control:RELEASE is limited to max 16 chars - take care in regards to the CREATOR_TAG
|
||||
# AIO/control:RELEASE is limited to max 16 chars - take care in regards to the CREATOR_TAG
|
||||
RELEASE="${STATUS_INTEGRATION_RELEASE}"
|
||||
fi
|
||||
fi
|
||||
@@ -67,8 +64,8 @@ builder_config() {
|
||||
echo "Loaded builder configuration: $config"
|
||||
|
||||
# Check variables
|
||||
if [ -z ${OPSI_REPOS_BASE_DIR} ] || [ ! -d ${OPSI_REPOS_BASE_DIR} ] ; then
|
||||
echo "configuration error: OPSI_REPOS_BASE_DIR directory does not exist: $OPSI_REPOS_BASE_DIR"
|
||||
if [ -z ${AIO_REPOS_BASE_DIR} ] || [ ! -d ${AIO_REPOS_BASE_DIR} ] ; then
|
||||
echo "configuration error: AIO_REPOS_BASE_DIR directory does not exist: $AIO_REPOS_BASE_DIR"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
@@ -77,8 +74,8 @@ builder_config() {
|
||||
fi
|
||||
|
||||
# Check, if variable is numeric
|
||||
if [ ! `expr ${OPSI_REPOS_PURGE_LIMIT} + 1 2> /dev/null` ] ; then
|
||||
fatal_error "OPSI_REPOS_PURGE_LIMIT must be numeric"
|
||||
if [ ! `expr ${AIO_REPOS_PURGE_LIMIT} + 1 2> /dev/null` ] ; then
|
||||
fatal_error "AIO_REPOS_PURGE_LIMIT must be numeric"
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -89,8 +86,8 @@ builder_config() {
|
||||
builder_prepare() {
|
||||
echo "builder_prepare: "
|
||||
# Check if the package is still build
|
||||
if [ "$OPSI_REPOS_FORCE_UPLOAD" != "true" ] && [ -f "${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN}.opsi" ] ; then
|
||||
echo "File ${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN}.opsi already exists."
|
||||
if [ "$AIO_REPOS_FORCE_UPLOAD" != "true" ] && [ -f "${AIO_REPOS_PRODUCT_DIR}/${AIO_REPOS_FILE_PATTERN}.7z" ] ; then
|
||||
echo "File ${AIO_REPOS_PRODUCT_DIR}/${AIO_REPOS_FILE_PATTERN}.7z already exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -98,7 +95,7 @@ builder_prepare() {
|
||||
log_debug "Distribution directory: $DIST_CACHE_DIR"
|
||||
|
||||
# setup work directory
|
||||
OUTPUT_DIR="$TMP_DIR/opsi-builder.`date +%Y%m%d-%H%M%S`.$$"
|
||||
OUTPUT_DIR="$TMP_DIR/aio-builder.`date +%Y%m%d-%H%M%S`.$$"
|
||||
mkdir -p ${OUTPUT_DIR}
|
||||
builder_check_error "Cannot create temp directory ${OUTPUT_DIR}"
|
||||
|
||||
@@ -190,17 +187,11 @@ builder_retrieve() {
|
||||
builder_create() {
|
||||
|
||||
# Copy files and convert text files to dos format
|
||||
cp -Rv ${PRODUCT_DIR}/OPSI $INST_DIR
|
||||
cp -Rv ${PRODUCT_DIR}/CLIENT_DATA $INST_DIR
|
||||
if [ -d "${PRODUCT_DIR}/SERVER_DATA" ] ; then
|
||||
cp -Rv ${PRODUCT_DIR}/SERVER_DATA $INST_DIR
|
||||
fi
|
||||
|
||||
# converting icon file
|
||||
local iconfile_src=${DL_DIST_FILE[$ICON_DL_INDEX]}
|
||||
ICONFILE=$OUTPUT_DIR/$PN.png
|
||||
convert_image $iconfile_src $ICONFILE
|
||||
cp -a $ICONFILE $INST_DIR/CLIENT_DATA
|
||||
# cp -Rv ${PRODUCT_DIR}/AIO $INST_DIR
|
||||
# cp -Rv ${PRODUCT_DIR}/CLIENT_DATA $INST_DIR
|
||||
# if [ -d "${PRODUCT_DIR}/SERVER_DATA" ] ; then
|
||||
# cp -Rv ${PRODUCT_DIR}/SERVER_DATA $INST_DIR
|
||||
# fi
|
||||
|
||||
# copy binaries
|
||||
for (( i = 0 ; i < ${#DL_SOURCE[@]} ; i++ )) ; do
|
||||
@@ -214,58 +205,26 @@ builder_create() {
|
||||
process_file $format ${DL_DIST_FILE[$i]} ${DL_EXTRACT_PATH[$i]} $option
|
||||
done
|
||||
|
||||
# create winst variables
|
||||
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 $var_file
|
||||
|
||||
echo ";Hardcoded opsi vars" >>$var_file
|
||||
echo "Set \$ProductId\$ = \"$PN\"" >>$var_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@@/ {
|
||||
r "$var_file"
|
||||
d
|
||||
}" $inst_file
|
||||
local ini_file=${INST_DIR}/aio-$PN.ini
|
||||
|
||||
for var in VENDOR PN VERSION RELEASE TYPE CREATOR_TAG CREATOR_NAME CREATOR_EMAIL ; do
|
||||
write_ini_file $ini_file "COMMON" ${var}="${!var}"
|
||||
done
|
||||
|
||||
# convert to dos file linefeed
|
||||
find $INST_DIR/CLIENT_DATA -type f | xargs -n1 -iREP sh -c 'file -i $0 | grep -v "utf-16" | grep "text/plain" && '$CMD_unix2dos' $0 ' REP >/dev/null
|
||||
find $INST_DIR -type f | xargs -n1 -iREP sh -c 'file -i $0 | grep -v "utf-16" | grep "text/plain" && '$CMD_unix2dos' $0 ' REP >/dev/null
|
||||
|
||||
# set exec bit on executeables
|
||||
find $INST_DIR/CLIENT_DATA -type f -iname "*.exe" -o -iname "*.bat" -o -iname "*.cmd" -o -iname "*.msi" -o -iname "*.msp" | xargs chmod +x -v
|
||||
find $INST_DIR -type f -iname "*.exe" -o -iname "*.bat" -o -iname "*.cmd" -o -iname "*.msi" -o -iname "*.msp" | xargs chmod +x -v
|
||||
|
||||
# replace variables from file OPSI/control
|
||||
local release_new=${CREATOR_TAG}${RELEASE}
|
||||
# sed -e "s!VERSION!$VERSION!g" -e "s!RELEASE!${release_new}!g" -e "s!PRIORITY!$PRIORITY!g" -e "s!ADVICE!$ADVICE!g" ${PRODUCT_DIR}/OPSI/control >$INST_DIR/OPSI/control
|
||||
write_control_file $INST_DIR/OPSI/control "Package" "version" "${release_new}"
|
||||
write_control_file $INST_DIR/OPSI/control "Product" "id" "$PN"
|
||||
write_control_file $INST_DIR/OPSI/control "Product" "name" "$NAME"
|
||||
write_control_file $INST_DIR/OPSI/control "Product" "description" "$DESCRIPTION"
|
||||
write_control_file $INST_DIR/OPSI/control "Product" "advice" "$ADVICE"
|
||||
write_control_file $INST_DIR/OPSI/control "Product" "version" "$VERSION"
|
||||
write_control_file $INST_DIR/OPSI/control "Product" "priority" "$PRIORITY"
|
||||
|
||||
# Create changelog based on git - if available
|
||||
if [ -d "${PRODUCT_DIR}/.git" ] ; then
|
||||
# new changelog format
|
||||
echo "" >> $INST_DIR/OPSI/control
|
||||
echo "[Changelog]" >> $INST_DIR/OPSI/control
|
||||
$CMD_ruby $BASEDIR/libexec/gitlog-to-deblog.rb >> $INST_DIR/OPSI/control
|
||||
echo "" >> $INST_DIR/OPSI/control
|
||||
rm -f $INST_DIR/OPSI/changelog.txt
|
||||
|
||||
#old changelog format
|
||||
#git log --date-order --date=short | \
|
||||
#sed -e '/^commit.*$/d' | \
|
||||
#awk '/^Author/ {sub(/\\$/,""); getline t; print $0 t; next}; 1' | \
|
||||
#sed -e 's/^Author: //g' | \
|
||||
#sed -e 's/>Date: \([0-9]*-[0-9]*-[0-9]*\)/>\t\1/g' | \
|
||||
#sed -e 's/^\(.*\) \(\)\t\(.*\)/\3 \1 \2/g' > $INST_DIR/OPSI/changelog.txt
|
||||
echo "" >> $INST_DIR/changelog.txt
|
||||
echo "[Changelog]" >> $INST_DIR/changelog.txt
|
||||
#$CMD_ruby $BASEDIR/libexec/gitlog-to-deblog.rb >> $INST_DIR/AIO/changelog.txt
|
||||
echo "" >> $INST_DIR/changelog.txt
|
||||
else
|
||||
echo "No git repository present."
|
||||
fi
|
||||
@@ -273,30 +232,30 @@ builder_create() {
|
||||
}
|
||||
|
||||
#####################
|
||||
# build opsi package
|
||||
# build aio package
|
||||
#####################
|
||||
builder_package() {
|
||||
|
||||
# creating package
|
||||
local release_new=${CREATOR_TAG}${RELEASE}
|
||||
local opsi_file=${PN}_${VERSION}-${release_new}.opsi
|
||||
local aio_file=${PN}_${VERSION}-${release_new}.7z
|
||||
|
||||
pushd ${OUTPUT_DIR}
|
||||
rm -f ${opsi_file} ${OPSI_REPOS_FILE_PATTERN}.opsi
|
||||
LANG="C" opsi-makeproductfile -v $INST_DIR
|
||||
builder_check_error "Building OPSI-package"
|
||||
rm -f ${aio_file} ${AIO_REPOS_FILE_PATTERN}.7z
|
||||
7z a ${AIO_REPOS_FILE_PATTERN}.7z -v $INST_DIR/*
|
||||
builder_check_error "Building AIO-package"
|
||||
popd
|
||||
|
||||
# rename opsi package file
|
||||
if [ "${opsi_file}" != "${OPSI_REPOS_FILE_PATTERN}.opsi" ]; then
|
||||
mv ${OUTPUT_DIR}/${opsi_file} ${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}.opsi
|
||||
builder_check_error "can't move file ${OUTPUT_DIR}/${opsi_file} ${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}.opsi"
|
||||
# rename aio package file
|
||||
if [ "${aio_file}" != "${AIO_REPOS_FILE_PATTERN}.7z" ]; then
|
||||
mv ${OUTPUT_DIR}/${aio_file} ${OUTPUT_DIR}/${AIO_REPOS_FILE_PATTERN}.7z
|
||||
builder_check_error "can't move file ${OUTPUT_DIR}/${aio_file} ${OUTPUT_DIR}/${AIO_REPOS_FILE_PATTERN}.7z"
|
||||
fi
|
||||
|
||||
# --exclude \*/.git\*
|
||||
# create source- and binary package package
|
||||
test "${OPSI_REPOS_UPLOAD_BIN}" = "true" && $CMD_zip --exclude \*/.git\* @ -r ${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}.zip $INST_DIR
|
||||
test "${OPSI_REPOS_UPLOAD_SOURCE}" = "true" && $CMD_zip --exclude \*/.git\* @ -r ${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}-src.zip ${PRODUCT_DIR}
|
||||
test "${AIO_REPOS_UPLOAD_BIN}" = "true" && $CMD_zip --exclude \*/.git\* @ -r ${OUTPUT_DIR}/${AIO_REPOS_FILE_PATTERN}.zip $INST_DIR
|
||||
test "${AIO_REPOS_UPLOAD_SOURCE}" = "true" && $CMD_zip --exclude \*/.git\* @ -r ${OUTPUT_DIR}/${AIO_REPOS_FILE_PATTERN}-src.zip ${PRODUCT_DIR}
|
||||
}
|
||||
|
||||
|
||||
@@ -306,55 +265,52 @@ builder_package() {
|
||||
builder_publish() {
|
||||
|
||||
# Upload file to repository
|
||||
mkdir -p ${OPSI_REPOS_PRODUCT_DIR}
|
||||
mkdir -p ${AIO_REPOS_PRODUCT_DIR}
|
||||
|
||||
echo "Publishing opsi-package to ${OPSI_REPOS_PRODUCT_DIR}"
|
||||
local src=${OUTPUT_DIR}/${OPSI_REPOS_FILE_PATTERN}
|
||||
local dst=${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN}
|
||||
echo "Publishing aio-package to ${AIO_REPOS_PRODUCT_DIR}"
|
||||
local src=${OUTPUT_DIR}/${AIO_REPOS_FILE_PATTERN}
|
||||
local dst=${AIO_REPOS_PRODUCT_DIR}/${AIO_REPOS_FILE_PATTERN}
|
||||
|
||||
# Link dir
|
||||
if [ "${OPSI_REPOS_LINK_NEWBUILDS}" = "true" ] ; then
|
||||
mkdir -p ${OPSI_REPOS_BASE_DIR}/.new_builds
|
||||
ln -sf ${OPSI_REPOS_PRODUCT_DIR} ${OPSI_REPOS_BASE_DIR}/.new_builds/${OPSI_REPOS_FILE_PATTERN}
|
||||
builder_check_error "Can't Link file $dst.opsi --> $dst.opsi"
|
||||
if [ "${AIO_REPOS_LINK_NEWBUILDS}" = "true" ] ; then
|
||||
mkdir -p ${AIO_REPOS_BASE_DIR}/.new_builds
|
||||
ln -sf ${AIO_REPOS_PRODUCT_DIR} ${AIO_REPOS_BASE_DIR}/.new_builds/${AIO_REPOS_FILE_PATTERN}
|
||||
builder_check_error "Can't Link file $dst.7z --> $dst.7z"
|
||||
fi
|
||||
|
||||
# copy files
|
||||
if [ "${OPSI_REPOS_UPLOAD_OPSI}" = "true" ] ; then
|
||||
cp ${src}.opsi ${dst}.opsi
|
||||
builder_check_error "Can't upload file $dst.opsi --> $dst.opsi"
|
||||
if [ "${AIO_REPOS_UPLOAD_AIO}" = "true" ] ; then
|
||||
cp ${src}.7z ${dst}.7z
|
||||
builder_check_error "Can't upload file $dst.7z --> $dst.7z"
|
||||
fi
|
||||
|
||||
if [ "${OPSI_REPOS_UPLOAD_BIN}" = "true" ] ; then
|
||||
if [ "${AIO_REPOS_UPLOAD_BIN}" = "true" ] ; then
|
||||
cp ${src}.zip ${dst}.zip
|
||||
builder_check_error "Can't upload file $dst.zip --> $dst.zip"
|
||||
fi
|
||||
|
||||
if [ "${OPSI_REPOS_UPLOAD_SOURCE}" = "true" ] ; then
|
||||
if [ "${AIO_REPOS_UPLOAD_SOURCE}" = "true" ] ; then
|
||||
cp ${src}-src.zip ${dst}-src.zip
|
||||
builder_check_error "Can't upload file ${dst}-src.zip --> ${dst}-src.zip"
|
||||
fi
|
||||
|
||||
if [ "${OPSI_REPOS_OPSIMANAGER_INSTALL}" = "true" ] ; then
|
||||
opsi-package-manager -i -v ${src}.opsi
|
||||
builder_check_error "Can't install ${src}.opsi"
|
||||
if [ "${AIO_REPOS_AIOMANAGER_INSTALL}" = "true" ] ; then
|
||||
aio-package-manager -i -v ${src}.7z
|
||||
builder_check_error "Can't install ${src}.7z"
|
||||
fi
|
||||
|
||||
if [ "${OPSI_REPOS_UPLOAD_OPSI_ZSYNC}" = "true" ] ; then
|
||||
md5sum "${src}.opsi" | sed 's/ .*//' > ${dst}.opsi.md5
|
||||
if [ "${AIO_REPOS_UPLOAD_AIO}" = "true" ] ; then
|
||||
md5sum "${src}.7z" | sed 's/ .*//' > ${dst}.7z.md5
|
||||
builder_check_error "Can't create md5 file"
|
||||
|
||||
${CMD_zsyncmake} -u ${OPSI_REPOS_FILE_PATTERN}.opsi -o "${dst}.opsi.zsync" "${src}.opsi"
|
||||
builder_check_error "Can't create zsync file"
|
||||
fi
|
||||
|
||||
if [ "${OPSI_REPOS_UPLOAD_OPSI_GPG}" = "true" ] ; then
|
||||
${CMD_gpg} --batch --passphrase ${GPG_PASSPHRASE} --output "${dst}.opsi.gpg" --detach-sig "${src}.opsi"
|
||||
if [ "${AIO_REPOS_UPLOAD_AIO_GPG}" = "true" ] ; then
|
||||
${CMD_gpg} --batch --passphrase ${GPG_PASSPHRASE} --output "${dst}.7z.gpg" --detach-sig "${src}.7z"
|
||||
builder_check_error "Can't create gpg file"
|
||||
fi
|
||||
|
||||
# Create revision file for this
|
||||
local rev_file=${OPSI_REPOS_PRODUCT_DIR}/${PN}-${VERSION}-${CREATOR_TAG}${RELEASE}.cfg
|
||||
local rev_file=${AIO_REPOS_PRODUCT_DIR}/${PN}-${VERSION}-${CREATOR_TAG}${RELEASE}.cfg
|
||||
cat > $rev_file <<EOF
|
||||
REV_VENDOR=${VENDOR}
|
||||
REV_PN=${PN}
|
||||
@@ -365,20 +321,20 @@ REV_TYPE=${TYPE}
|
||||
REV_STATUS=${STATUS}
|
||||
REV_TIMESTAMP=`date +"%s"`
|
||||
REV_CREATOR_TAG=${CREATOR_TAG}
|
||||
REV_OPSI_REPOS_FILE_PATTERN=${OPSI_REPOS_FILE_PATTERN}
|
||||
REV_AIO_REPOS_FILE_PATTERN=${AIO_REPOS_FILE_PATTERN}
|
||||
EOF
|
||||
|
||||
|
||||
# Purge old product versions - defined by limit OPSI_REPOS_PURGE_LIMIT
|
||||
if [ "${OPSI_REPOS_PURGE}" = "true" ] && [ ! -z "${OPSI_REPOS_PURGE_LIMIT}" ] && [ "${OPSI_REPOS_PURGE_LIMIT}" > 0 ] && [ "${STATUS}" = "${OPSI_REPOS_PURGE_STATUS}" ] ; then
|
||||
# Purge old product versions - defined by limit AIO_REPOS_PURGE_LIMIT
|
||||
if [ "${AIO_REPOS_PURGE}" = "true" ] && [ ! -z "${AIO_REPOS_PURGE_LIMIT}" ] && [ "${AIO_REPOS_PURGE_LIMIT}" > 0 ] && [ "${STATUS}" = "${AIO_REPOS_PURGE_STATUS}" ] ; then
|
||||
echo "Autopurging enabled"
|
||||
|
||||
# determinte max version to delete
|
||||
local limit
|
||||
local pn_limit=`echo ${PN} | sed "s/[\.\-]/_/g"`
|
||||
eval "`echo limit=\\$\\{OPSI_REPOS_PURGE_LIMIT_${pn_limit}\\}`"
|
||||
eval "`echo limit=\\$\\{AIO_REPOS_PURGE_LIMIT_${pn_limit}\\}`"
|
||||
if [ -z "$limit" ] || [ ! `expr $limit + 1 2>/dev/null` ] ; then
|
||||
limit=${OPSI_REPOS_PURGE_LIMIT}
|
||||
limit=${AIO_REPOS_PURGE_LIMIT}
|
||||
fi
|
||||
echo " Purging, max. number of versions: $limit"
|
||||
|
||||
@@ -391,7 +347,7 @@ EOF
|
||||
rm -f ${file_list}
|
||||
|
||||
# first uniq sort all cfg based on version
|
||||
for cfg_file in `find ${OPSI_REPOS_PRODUCT_DIR} -name "${PN}-*.cfg" -print ` ; do
|
||||
for cfg_file in `find ${AIO_REPOS_PRODUCT_DIR} -name "${PN}-*.cfg" -print ` ; do
|
||||
. ${cfg_file}
|
||||
echo $REV_VERSION >> ${file_list}
|
||||
done
|
||||
@@ -399,7 +355,7 @@ EOF
|
||||
|
||||
# second uniq sort all versions based in release
|
||||
for pkg_version in `cat ${file_sort_list_version}` ; do
|
||||
for cfg_file_ver in ${OPSI_REPOS_PRODUCT_DIR}/${PN}-${pkg_version}-*.cfg ; do
|
||||
for cfg_file_ver in ${AIO_REPOS_PRODUCT_DIR}/${PN}-${pkg_version}-*.cfg ; do
|
||||
. ${cfg_file_ver}
|
||||
echo ${pkg_version}-$REV_CREATOR_TAG$REV_RELEASE >> ${file_sort_list_release}
|
||||
done
|
||||
@@ -408,8 +364,8 @@ EOF
|
||||
|
||||
# third create versionrelease
|
||||
for release_file_list in `cat ${file_sort_list_final}` ; do
|
||||
. ${OPSI_REPOS_PRODUCT_DIR}/${PN}-${release_file_list}.cfg
|
||||
echo "${OPSI_REPOS_PRODUCT_DIR}/${PN}-${release_file_list}.cfg" >> ${file_sort_list}
|
||||
. ${AIO_REPOS_PRODUCT_DIR}/${PN}-${release_file_list}.cfg
|
||||
echo "${AIO_REPOS_PRODUCT_DIR}/${PN}-${release_file_list}.cfg" >> ${file_sort_list}
|
||||
done
|
||||
|
||||
# Delete the oldest files
|
||||
@@ -417,14 +373,14 @@ EOF
|
||||
for cfg_sort_file in `head -n-${limit} ${file_sort_list}` ; do
|
||||
|
||||
. ${cfg_sort_file}
|
||||
if [ "${REV_STATUS}" != "${OPSI_REPOS_PURGE_STATUS}" ] ; then continue; fi
|
||||
if [ "${REV_STATUS}" != "${AIO_REPOS_PURGE_STATUS}" ] ; then continue; fi
|
||||
|
||||
dir_base=`dirname ${cfg_file}`
|
||||
product_file="${dir_base}/${REV_OPSI_REPOS_FILE_PATTERN}"
|
||||
product_file="${dir_base}/${REV_AIO_REPOS_FILE_PATTERN}"
|
||||
echo " Purging product version: $product_file*"
|
||||
|
||||
# Paranoid ... check the files to delete first
|
||||
if [ ! -z "${dir_base}" ] && [ -d "${OPSI_REPOS_BASE_DIR}" ] && [ ! -z "$product_file" ] ; then
|
||||
if [ ! -z "${dir_base}" ] && [ -d "${AIO_REPOS_BASE_DIR}" ] && [ ! -z "$product_file" ] ; then
|
||||
rm -f ${product_file}* ${cfg_sort_file}
|
||||
|
||||
# remove directory - if it's empty
|
||||
@@ -448,11 +404,11 @@ builder_commit() {
|
||||
|
||||
|
||||
#####################
|
||||
# build opsi package
|
||||
# build aio package
|
||||
#####################
|
||||
builder_cleanup() {
|
||||
# Paranoia
|
||||
if [ -d "$OUTPUT_DIR" ] && [[ $OUTPUT_DIR == $TMP_DIR/opsi-builder.* ]] ; then
|
||||
if [ -d "$OUTPUT_DIR" ] && [[ $OUTPUT_DIR == $TMP_DIR/aio-builder.* ]] ; then
|
||||
rm -rf $OUTPUT_DIR
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -138,159 +138,6 @@ log_info() {
|
||||
fi
|
||||
}
|
||||
|
||||
###################
|
||||
# Convert image
|
||||
###################
|
||||
convert_image() {
|
||||
local src=$1
|
||||
local dst=$2
|
||||
|
||||
local hight=`${CMD_identify} -format "%h" $src`
|
||||
local wight=`${CMD_identify} -format "%w" $src`
|
||||
${CMD_identify} -format "%wx%h" $src
|
||||
|
||||
# Add a white border to the image so that the convert to transparent can go around an image
|
||||
convert -bordercolor White -border 3x3 $src $OUTPUT_DIR/bigger.png
|
||||
|
||||
# first resize the image to the new aspect ratio and add white borders
|
||||
if [ $wight -lt $hight ] ; then
|
||||
# Its higher so force x166 and let imagemagic decide the right wight
|
||||
# then add white to the rest of the image to fit 166x166
|
||||
log_debug "Icon Wight: $wight < Hight: $hight"
|
||||
convert $OUTPUT_DIR/bigger.png -colorspace RGB -resize x166 \
|
||||
-size 166x166 xc:white +swap -gravity center -composite \
|
||||
-modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png
|
||||
builder_check_error "converting image"
|
||||
elif [ $wight -gt $hight ] ; then
|
||||
# Its wider so force 166x and let imagemagic decide the right hight
|
||||
# then add white to the rest of the image to fit 166x166
|
||||
log_debug "Icon Wight: $wight > Hight: $hight"
|
||||
convert $OUTPUT_DIR/bigger.png -colorspace RGB -resize 166x \
|
||||
-size 166x166 xc:white +swap -gravity center -composite \
|
||||
-modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png
|
||||
builder_check_error "converting image"
|
||||
elif [ $wight -eq $hight ] ; then
|
||||
# Its scare so force 166x166
|
||||
log_debug "Icon Wight: $wight = Hight: $hight"
|
||||
convert $OUTPUT_DIR/bigger.png -colorspace RGB -resize 166x166 \
|
||||
-size 166x166 xc:white +swap -gravity center -composite \
|
||||
-modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png
|
||||
builder_check_error "converting image"
|
||||
else
|
||||
# Imagemagic is unable to detect the aspect ratio so just force 166x166
|
||||
# this could result in streched images
|
||||
log_debug "Icon Wight: $wight unknown Hight: $hight"
|
||||
convert $OUTPUT_DIR/bigger.png -colorspace RGB -resize 166x166 \
|
||||
-size 166x166 xc:white +swap -gravity center -composite \
|
||||
-modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png
|
||||
builder_check_error "converting image"
|
||||
fi
|
||||
|
||||
# create a diffence image from the source
|
||||
convert $OUTPUT_DIR/resize.png \( +clone -fx 'p{0,0}' \) -compose Difference -composite \
|
||||
-modulate 100,0 +matte $OUTPUT_DIR/difference.png
|
||||
|
||||
# remove the black, replace with transparency
|
||||
convert $OUTPUT_DIR/difference.png -bordercolor white -border 1x1 -matte \
|
||||
-fill none -fuzz 7% -draw 'matte 1,1 floodfill' -shave 1x1 \
|
||||
$OUTPUT_DIR/removed_black.png
|
||||
|
||||
# create the matte
|
||||
if [ `convert | grep Version | awk '{print $3}' | sed "s/-.*//" | sed "s/\.//g"` -le 670 ] ; then
|
||||
convert $OUTPUT_DIR/removed_black.png -channel matte -separate +matte \
|
||||
$OUTPUT_DIR/matte.png
|
||||
else
|
||||
convert $OUTPUT_DIR/removed_black.png -channel matte -negate -separate +matte \
|
||||
$OUTPUT_DIR/matte.png
|
||||
fi
|
||||
|
||||
# negate the colors
|
||||
convert $OUTPUT_DIR/matte.png -negate -blur 0x1 \
|
||||
$OUTPUT_DIR/matte-negated.png
|
||||
|
||||
# you are going for: white interior, black exterior
|
||||
composite -compose CopyOpacity $OUTPUT_DIR/matte-negated.png $OUTPUT_DIR/resize.png \
|
||||
$OUTPUT_DIR/smaller.png
|
||||
|
||||
# now remove the added border that was added eaerlier
|
||||
# Chop 3 pixels from the top and left side of
|
||||
convert -chop 3x3 -rotate 180 $OUTPUT_DIR/smaller.png $OUTPUT_DIR/rotate.png
|
||||
|
||||
# Chop 3 pixels from the bottom and right side
|
||||
convert -chop 3x3 -rotate 180 $OUTPUT_DIR/rotate.png $dst
|
||||
|
||||
# New size
|
||||
# identify -format "%wx%h" $dst
|
||||
hight=`${CMD_identify} -format "%h" $dst`
|
||||
wight=`${CMD_identify} -format "%w" $dst`
|
||||
log_debug "Opsi Icon Wight: $wight Hight: $hight"
|
||||
|
||||
}
|
||||
|
||||
|
||||
###################
|
||||
# Create variable file
|
||||
#
|
||||
# Create a file containing all important winst variables
|
||||
# (declaration and setings)
|
||||
#
|
||||
# Parameter
|
||||
# file: file to create
|
||||
#
|
||||
###################
|
||||
create_winst_varfile() {
|
||||
local var_file=$1
|
||||
|
||||
echo -n >$var_file
|
||||
echo "; Opsi Builder Variables" >>$var_file
|
||||
|
||||
# make the scriptpath for the binarys configurable
|
||||
echo "DefVar \$PackagePath\$" >>$var_file
|
||||
echo "Set \$PackagePath\$ = \"%ScriptPath%\"" >>$var_file
|
||||
|
||||
echo >>$var_file
|
||||
for (( i = 0 ; i < ${#DL_SOURCE[@]} ; i++ )) ; do
|
||||
if [ -z ${DL_WINST_NAME[$i]} ] ; then continue ; fi
|
||||
|
||||
if [ ! -z "${DL_ARCH[$i]}" ] ; then arch_str="${DL_ARCH[$i]}\\" ; fi
|
||||
echo "DefVar \$${DL_WINST_NAME[$i]}\$" >>$var_file
|
||||
echo "Set \$${DL_WINST_NAME[$i]}\$ = \$PackagePath\$ + \"\\${arch_str}${DL_FILE[$i]}\"" >>$var_file
|
||||
done
|
||||
|
||||
# publish some other variables
|
||||
for var in VENDOR PN VERSION RELEASE PRIORITY NAME ADVICE TYPE CREATOR_TAG CREATOR_NAME CREATOR_EMAIL ; do
|
||||
echo "DefVar \$${var}\$" >>$var_file
|
||||
echo "Set \$${var}\$ = \"${!var}\"" >>$var_file
|
||||
done
|
||||
|
||||
# copy image and create variable
|
||||
echo "DefVar \$IconFile\$" >>$var_file
|
||||
echo "Set \$IconFile\$ = \"%ScriptPath%\\`basename $ICONFILE`\"" >>$var_file
|
||||
|
||||
# publish custom variables
|
||||
for (( i = 0 ; i < ${#WINST_NAME[@]} ; i++ )) ; do
|
||||
|
||||
# replace DL_EXTRACT_WINST_PATH
|
||||
local index=`echo ${WINST_VALUE[$i]} | sed -e "s#.*@DL_EXTRACT_WINST_PATH\[\([0-9]\)\]@.*#\1#"`
|
||||
log_debug "calculated (DL_EXTRACT_WINST_PATH), Index: $index"
|
||||
if [ "$index" != "${WINST_VALUE[$i]}" ] ; then
|
||||
if [ ! -z "${DL_ARCH[$index]}" ] ; then arch_part="\\\\${DL_ARCH[$index]}" ; fi
|
||||
if [ ! -z "${DL_EXTRACT_WINST_PATH[$index]}" ] ; then extr_part="\\\\${DL_EXTRACT_WINST_PATH[$index]}" ; fi
|
||||
local new_val="\$PackagePath\$ + $arch_part$extr_part"
|
||||
WINST_VALUE[$i]=`echo ${WINST_VALUE[$i]} | sed -e "s#@DL_EXTRACT_WINST_PATH\[[0-9]\]@#$new_val#"`
|
||||
log_debug "calculated (DL_EXTRACT_WINST_PATH) WINST_VALUE: ${WINST_VALUE[$i]}"
|
||||
fi
|
||||
|
||||
echo "DefVar \$${WINST_NAME[$i]}\$" >>$var_file
|
||||
echo "Set \$${WINST_NAME[$i]}\$ = \"${WINST_VALUE[$i]}\"" >>$var_file
|
||||
done
|
||||
|
||||
# correct me im a hack
|
||||
sed -e 's#"\$PackagePath\$ +#\$PackagePath\$ + "#' -i $var_file
|
||||
sed -e 's#\$PackagePath\$ + " #\$PackagePath\$ + "#' -i $var_file
|
||||
echo >>$var_file
|
||||
}
|
||||
|
||||
#####################
|
||||
# void calc_release()
|
||||
#
|
||||
@@ -304,8 +151,8 @@ create_winst_varfile() {
|
||||
function calc_release() {
|
||||
|
||||
# Find all revision files and sort them
|
||||
local file_list=`mktemp /tmp/opsi-builder.calc_release.XXXXXXXXXXX`
|
||||
for cfg_file in `find ${OPSI_REPOS_BASE_DIR} -name "${PN}-${VERSION}-${CREATOR_TAG}*.cfg" -print ` ; do
|
||||
local file_list=`mktemp /tmp/aio-builder.calc_release.XXXXXXXXXXX`
|
||||
for cfg_file in `find ${AIO_REPOS_BASE_DIR} -name "${PN}-${VERSION}-${CREATOR_TAG}*.cfg" -print ` ; do
|
||||
. ${cfg_file}
|
||||
printf "%08d;$cfg_file\n" $REV_RELEASE >> ${file_list}
|
||||
done
|
||||
@@ -335,43 +182,70 @@ function calc_release() {
|
||||
###################
|
||||
write_ini_file() {
|
||||
local ini_file=$1
|
||||
local var_file=$2
|
||||
|
||||
# create file if not exist
|
||||
local ini_section=$2
|
||||
local ini_option=$3
|
||||
local ini_value=$4
|
||||
|
||||
touch $ini_file
|
||||
|
||||
# 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
|
||||
|
||||
echo "; Opsi INI File Variables" >>$var_file
|
||||
echo >>$var_file
|
||||
# publish custom variables
|
||||
for (( i = 0 ; i < ${#OPSI_INI_OPTION[@]} ; i++ )) ; do
|
||||
$CMD_iniset $ini_file --${OPSI_INI_SECTION[$i]} ${OPSI_INI_OPTION[$i]}="${OPSI_INI_VALUE[$i]}"
|
||||
echo "DefVar \$${OPSI_INI_OPTION[$i]}\$" >>$var_file
|
||||
echo "Set \$${OPSI_INI_OPTION[$i]}\$ = \"${OPSI_INI_VALUE[$i]}\"" >>$var_file
|
||||
done
|
||||
|
||||
echo >>$var_file
|
||||
$CMD_inifile $(cygpath -pw "$ini_file") [$ini_section] $ini_option=$ini_value
|
||||
}
|
||||
|
||||
|
||||
###################
|
||||
# Write control file
|
||||
# Get Verison of File
|
||||
#
|
||||
# Create a ini file containing needed information for package uninstall
|
||||
# Copy file only if it is newer
|
||||
#
|
||||
# Parameter
|
||||
# file: file to create / modify
|
||||
# File: to process
|
||||
# Var:
|
||||
#
|
||||
###################
|
||||
write_control_file() {
|
||||
local control_file=$1
|
||||
local control_section=$2
|
||||
local control_option=$3
|
||||
local control_value=$4
|
||||
get_file_version() {
|
||||
local getver_file=$1
|
||||
local getver_var=$2
|
||||
|
||||
sed -i -e "/^\[$control_section\]/,/^\[.*\]/ s|^\($control_option[ \t]*:[ \t]*\).*$|\1$control_value|" "$control_file"
|
||||
if [ -f "$getver_file" ] ; then
|
||||
$CMD_showver $getver_file | grep FileVersion: | rev | cut -d: -f1 | rev | tr -d ' ' > $getver_ver
|
||||
echo "file $getver_file has version $getver_ver"
|
||||
else
|
||||
echo "$getver_file not found"
|
||||
fi
|
||||
}
|
||||
|
||||
###################
|
||||
# Copy Verison
|
||||
#
|
||||
# Copy file only if it is newer
|
||||
#
|
||||
# Parameter
|
||||
# source: sourcefiel
|
||||
# target: Targetfile
|
||||
#
|
||||
###################
|
||||
copyver() {
|
||||
local source_file=$1
|
||||
local target_file=$2
|
||||
local source_ver
|
||||
local target_ver
|
||||
|
||||
get_file_version $source_file $source_ver
|
||||
}
|
||||
|
||||
###################
|
||||
# Tidy xml
|
||||
#
|
||||
# Tidy XML files (mainly Sereby package.xml)
|
||||
#
|
||||
# Parameter
|
||||
# source: sourcefiel
|
||||
# target: Targetfile
|
||||
#
|
||||
###################
|
||||
tidy_xml() {
|
||||
local source_file=$1
|
||||
local target_file=$2
|
||||
|
||||
cat $source_file | $CMD_tidy -utf8 -xml -w 255 -i -c -q -asxml | sed -e 's!>!>!g' -e 's!<!<!g' > $target_file
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user