- new: customize calling command "identity", "unix2dos" by using $CMD_identify, $CMD_unix2dos
- improvement: changed name of tmp-directory (date format)
This commit is contained in:
parent
6336aa67b4
commit
b93d43e140
@ -11,10 +11,12 @@
|
|||||||
builder_config() {
|
builder_config() {
|
||||||
|
|
||||||
# Define commands
|
# Define commands
|
||||||
CMD_7z="`which 7z`" ; builder_check_error "No 7z installed"
|
CMD_7z="`which 7z`" ; builder_check_error "Command '7z' not installed"
|
||||||
CMD_unzip="`which unzip`" ; builder_check_error "No unzip installed"
|
CMD_unzip="`which unzip`" ; builder_check_error "Command 'unzip' not installed"
|
||||||
CMD_zip="`which zip`" ; builder_check_error "No zip installed"
|
CMD_zip="`which zip`" ; builder_check_error "Command 'zip' 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"
|
||||||
|
|
||||||
# Check temp dir
|
# Check temp dir
|
||||||
test -d ${TMP_DIR}
|
test -d ${TMP_DIR}
|
||||||
@ -66,7 +68,7 @@ builder_config() {
|
|||||||
# Prepare build
|
# Prepare build
|
||||||
####################
|
####################
|
||||||
builder_prepare() {
|
builder_prepare() {
|
||||||
|
echo "builder_prepare: "
|
||||||
# Check if the package is still build
|
# Check if the package is still build
|
||||||
if [ -z "$OPSI_REPOS_FORCE_UPLOAD" ] && [ -f "${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN}.opsi" ] ; then
|
if [ -z "$OPSI_REPOS_FORCE_UPLOAD" ] && [ -f "${OPSI_REPOS_PRODUCT_DIR}/${OPSI_REPOS_FILE_PATTERN}.opsi" ] ; then
|
||||||
echo "Directory ${OPSI_REPOS_PRODUCT_DIR} already exists."
|
echo "Directory ${OPSI_REPOS_PRODUCT_DIR} already exists."
|
||||||
@ -74,15 +76,18 @@ builder_prepare() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $DIST_CACHE_DIR
|
mkdir -p $DIST_CACHE_DIR
|
||||||
echo "Distribution directory: $DIST_CACHE_DIR"
|
log_debug "Distribution directory: $DIST_CACHE_DIR"
|
||||||
|
|
||||||
# setup work directory
|
# setup work directory
|
||||||
OUTPUT_DIR=$(mktemp -d $TMP_DIR/opsi-builder.XXXXXXXXXX) || { echo "Failed to create temp dir"; exit 1; }
|
OUTPUT_DIR=$TMP_DIR/opsi-builder.`date +%Y%m%d-%H%M%S`
|
||||||
|
mkdir -p ${OUTPUT_DIR}
|
||||||
|
builder_check_error "Cannot create temp directory ${OUTPUT_DIR}"
|
||||||
|
|
||||||
# prepare
|
# prepare
|
||||||
INST_DIR=$OUTPUT_DIR/$PN
|
INST_DIR=$OUTPUT_DIR/$PN
|
||||||
mkdir $INST_DIR
|
mkdir $INST_DIR
|
||||||
|
|
||||||
|
log_info " OUTPUT_DIR: $OUTPUT_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -168,7 +173,7 @@ builder_create() {
|
|||||||
# Copy files and convert text files to dos format
|
# Copy files and convert text files to dos format
|
||||||
cp -Rv ${PRODUCT_DIR}/OPSI $INST_DIR
|
cp -Rv ${PRODUCT_DIR}/OPSI $INST_DIR
|
||||||
cp -Rv ${PRODUCT_DIR}/CLIENT_DATA $INST_DIR
|
cp -Rv ${PRODUCT_DIR}/CLIENT_DATA $INST_DIR
|
||||||
find $INST_DIR/CLIENT_DATA -type f | xargs -n1 -iREP sh -c 'file -i $0 | grep "text/plain" && unix2dos $0 ' REP >/dev/null
|
find $INST_DIR/CLIENT_DATA -type f | xargs -n1 -iREP sh -c 'file -i $0 | grep "text/plain" && '$CMD_unix2dos' $0 ' REP >/dev/null
|
||||||
|
|
||||||
# converting icon file
|
# converting icon file
|
||||||
local iconfile_src=${DL_DIST_FILE[$ICON_DL_INDEX]}
|
local iconfile_src=${DL_DIST_FILE[$ICON_DL_INDEX]}
|
||||||
@ -272,15 +277,15 @@ builder_publish() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${OPSI_REPOS_OPSIMANAGER_INSTALL}" = "true" ] ; then
|
if [ "${OPSI_REPOS_OPSIMANAGER_INSTALL}" = "true" ] ; then
|
||||||
opsi-package-manager -i -v ${dst}.opsi
|
opsi-package-manager -i -v ${src}.opsi
|
||||||
builder_check_error "Can't install ${dst}.opsi"
|
builder_check_error "Can't install ${src}.opsi"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${OPSI_REPOS_UPLOAD_OPSI_ZSYNC}" = "true" ] ; then
|
if [ "${OPSI_REPOS_UPLOAD_OPSI_ZSYNC}" = "true" ] ; then
|
||||||
md5sum "${dst}.opsi" | sed 's/ .*//' > ${dst}.opsi.md5
|
md5sum "${src}.opsi" | sed 's/ .*//' > ${dst}.opsi.md5
|
||||||
builder_check_error "Can't create md5 file"
|
builder_check_error "Can't create md5 file"
|
||||||
|
|
||||||
zsyncmake -u ${OPSI_REPOS_FILE_PATTERN}.opsi -o "${dst}.opsi.zsync" "${dst}.opsi"
|
${CMD_zsyncmake} -u ${OPSI_REPOS_FILE_PATTERN}.opsi -o "${dst}.opsi.zsync" "${src}.opsi"
|
||||||
builder_check_error "Can't create zsync file"
|
builder_check_error "Can't create zsync file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -130,9 +130,9 @@ convert_image() {
|
|||||||
local src=$1
|
local src=$1
|
||||||
local dst=$2
|
local dst=$2
|
||||||
|
|
||||||
local hight=`identify -format "%h" $src`
|
local hight=`${CMD_identify} -format "%h" $src`
|
||||||
local wight=`identify -format "%w" $src`
|
local wight=`${CMD_identify} -format "%w" $src`
|
||||||
identify -format "%wx%h" $src
|
${CMD_identify} -format "%wx%h" $src
|
||||||
|
|
||||||
if [ $wight -lt $hight ] ; then
|
if [ $wight -lt $hight ] ; then
|
||||||
# Its higher so force x160 and let imagemagic decide the right wight
|
# Its higher so force x160 and let imagemagic decide the right wight
|
||||||
@ -165,8 +165,8 @@ convert_image() {
|
|||||||
|
|
||||||
# New size
|
# New size
|
||||||
# identify -format "%wx%h" $dst
|
# identify -format "%wx%h" $dst
|
||||||
hight=`identify -format "%h" $dst`
|
hight=`${CMD_identify} -format "%h" $dst`
|
||||||
wight=`identify -format "%w" $dst`
|
wight=`${CMD_identify} -format "%w" $dst`
|
||||||
log_debug "Opsi Icon Wight: $wight Hight: $hight"
|
log_debug "Opsi Icon Wight: $wight Hight: $hight"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user