Merge branch 'master' of disconnected-by-peer.at:go-opsi/devtools
This commit is contained in:
commit
eaf1219a36
@ -82,20 +82,22 @@ builder_retrieve() {
|
|||||||
local urls=${SOURCE[$i]}
|
local urls=${SOURCE[$i]}
|
||||||
local arch=${ARCH[$i]}
|
local arch=${ARCH[$i]}
|
||||||
local downloaded=0
|
local downloaded=0
|
||||||
|
|
||||||
# Add private repos to the urls
|
# Add private repos to the urls
|
||||||
if [ ! -z ${DIST_PRIVATE_REPOS} ]; then
|
if [ ! -z ${DIST_PRIVATE_REPOS} ]; then
|
||||||
urls="${DIST_PRIVATE_REPOS}/$basename;$urls"
|
urls="${DIST_PRIVATE_REPOS}/$basename;$urls"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check existence of CRC file
|
# check existence of CRC file only in non devel mode
|
||||||
if [ ! -e ${PRODUCT_DIR}/${basename}.sha1sum ] ; then
|
if [ ! -z "${DEVEL}" ] ; then
|
||||||
echo "You need to create the checksums with: sha1sum ${DIST_CACHE_DIR}/${basename} > ${PRODUCT_DIR}/${basename}.sha1sum"
|
if [ ! -e ${PRODUCT_DIR}/${basename}.sha1sum ] ; then
|
||||||
exit 1
|
echo "You need to create the checksums with: sha1sum ${DIST_CACHE_DIR}/${basename} > ${PRODUCT_DIR}/${basename}.sha1sum"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading $basename"
|
echo "Downloading $basename"
|
||||||
# check downloading from the defined URLs
|
# check downloading from the defined URLs
|
||||||
for src in `echo $urls | sed -e 's/;/\n/g'` ; do
|
for src in `echo $urls | sed -e 's/;/\n/g'` ; do
|
||||||
if [ $downloaded == 1 ]; then continue; fi
|
if [ $downloaded == 1 ]; then continue; fi
|
||||||
|
|
||||||
@ -141,22 +143,60 @@ 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" && dos2unix $0' REP
|
find $INST_DIR/CLIENT_DATA -type f | xargs -n1 -iREP sh -c 'file -i $0 | grep "text/plain" && unix2dos $0' REP
|
||||||
|
|
||||||
# converting icon file
|
# converting icon file
|
||||||
local iconfile_src=${DIST_FILE[$ICON_FILE_INDEX]}
|
local iconfile_src=${DIST_FILE[$ICON_FILE_INDEX]}
|
||||||
ICONFILE=$OUTPUT_DIR/$PN.png
|
ICONFILE=$OUTPUT_DIR/$PN.png
|
||||||
convert -colorspace rgb $iconfile_src -transparent white -background transparent -resize 160x160 \
|
HIGHT=`identify -format "%h" $iconfile_src`
|
||||||
-size 160x160 xc:transparent +swap -gravity center -composite $ICONFILE
|
WIGHT=`identify -format "%w" $iconfile_src`
|
||||||
builder_check_error "converting image"
|
identify -format "%wx%h" $iconfile_src
|
||||||
|
|
||||||
|
if [ $WIGHT -lt $HIGHT ] ; then
|
||||||
|
# Its higher so force x160 and let imagemagic decide the right wight
|
||||||
|
# then add transparency to the rest of the image to fit 160x160
|
||||||
|
echo "Icon Wight: $WIGHT < Hight: $HIGHT"
|
||||||
|
convert $iconfile_src -transparent white -background transparent -resize x160 \
|
||||||
|
-size 160x160 xc:transparent +swap -gravity center -composite $ICONFILE
|
||||||
|
builder_check_error "converting image"
|
||||||
|
elif [ $WIGHT -gt $HIGHT ] ; then
|
||||||
|
# Its wider so force 160x and let imagemagic decide the right hight
|
||||||
|
# then add transparency to the rest of the image to fit 160x160
|
||||||
|
echo "Icon Wight: $WIGHT > Hight: $HIGHT"
|
||||||
|
convert $iconfile_src -transparent white -background transparent -resize 160x \
|
||||||
|
-size 160x160 xc:transparent +swap -gravity center -composite $ICONFILE
|
||||||
|
builder_check_error "converting image"
|
||||||
|
elif [ $WIGHT -eq $HIGHT ] ; then
|
||||||
|
# Its scare so force 160x160
|
||||||
|
echo "Icon Wight: $WIGHT = Hight: $HIGHT"
|
||||||
|
convert $iconfile_src -transparent white -background transparent -resize 160x160 \
|
||||||
|
-size 160x160 xc:transparent +swap -gravity center -composite $ICONFILE
|
||||||
|
builder_check_error "converting image"
|
||||||
|
else
|
||||||
|
# Imagemagic is unable to detect the aspect ratio so just force 160x160
|
||||||
|
# this could result in streched images
|
||||||
|
#echo "Icon Wight: $WIGHT Hight: $HIGHT"
|
||||||
|
convert $iconfile_src -transparent white -background transparent -resize 160x160 \
|
||||||
|
xc:transparent +swap -gravity center -composite $ICONFILE
|
||||||
|
builder_check_error "converting image"
|
||||||
|
fi
|
||||||
|
identify -format "%wx%h" $ICONFILE
|
||||||
|
HIGHT=`identify -format "%h" $ICONFILE`
|
||||||
|
WIGHT=`identify -format "%w" $ICONFILE`
|
||||||
|
echo "Opsi Icon Wight: $WIGHT Hight: $HIGHT"
|
||||||
cp -a $ICONFILE $INST_DIR/CLIENT_DATA
|
cp -a $ICONFILE $INST_DIR/CLIENT_DATA
|
||||||
|
|
||||||
|
|
||||||
# copy binaries
|
# copy binaries
|
||||||
for (( i = 0 ; i < ${#SOURCE[@]} ; i++ )) ; do
|
for (( i = 0 ; i < ${#SOURCE[@]} ; i++ )) ; do
|
||||||
distfile=${DIST_FILE[$i]}
|
distfile=${DIST_FILE[$i]}
|
||||||
mkdir -p $INST_DIR/CLIENT_DATA/${ARCH[$i]}
|
if [ ! -z "${INSTALL[$i]}" ] ; then
|
||||||
cp ${DIST_FILE[$i]} $INST_DIR/CLIENT_DATA/${ARCH[$i]}
|
mkdir -p $INST_DIR/CLIENT_DATA/${ARCH[$i]}/${EXTRACTTO[$i]}
|
||||||
|
extract_file ${DIST_FILE[$i]} $INST_DIR/CLIENT_DATA/${ARCH[$i]}/${EXTRACTTO[$i]}
|
||||||
|
else
|
||||||
|
mkdir -p $INST_DIR/CLIENT_DATA/${ARCH[$i]}
|
||||||
|
cp ${DIST_FILE[$i]} $INST_DIR/CLIENT_DATA/${ARCH[$i]}
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# create variables
|
# create variables
|
||||||
@ -165,8 +205,15 @@ builder_create() {
|
|||||||
for (( i = 0 ; i < ${#SOURCE[@]} ; i++ )) ; do
|
for (( i = 0 ; i < ${#SOURCE[@]} ; i++ )) ; do
|
||||||
if [ -z ${WINST[$i]} ] ; then continue ; fi
|
if [ -z ${WINST[$i]} ] ; then continue ; fi
|
||||||
if [ ! -z "${ARCH[$i]}" ] ; then arch_str="${ARCH[$i]}\\" ; fi
|
if [ ! -z "${ARCH[$i]}" ] ; then arch_str="${ARCH[$i]}\\" ; fi
|
||||||
echo "DefVar \$${WINST[$i]}\$" >>$var_file
|
if [ ! -z "${EXTRACTTO[$i]}" ] ; then extractto_str="${EXTRACTTO[$i]}\\" ; fi
|
||||||
echo "Set \$${WINST[$i]}\$ = \"%ScriptPath%\\$arch_str${FILE[$i]}\"" >>$var_file
|
if [ ! $i -eq $ICON_FILE_INDEX ] ; then
|
||||||
|
echo "DefVar \$${WINST[$i]}\$" >>$var_file
|
||||||
|
if [ ! -z "${INSTALL[$i]}" ] ; then
|
||||||
|
echo "Set \$${WINST[$i]}\$ = \"%ScriptPath%\\$arch_str$extractto_str${INSTALL[$i]}\"" >>$var_file
|
||||||
|
else
|
||||||
|
echo "Set \$${WINST[$i]}\$ = \"%ScriptPath%\\$arch_str${FILE[$i]}\"" >>$var_file
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# publish some other variables
|
# publish some other variables
|
||||||
@ -217,7 +264,7 @@ builder_package() {
|
|||||||
local opsi_file=${PN}_${VERSION}-${release_new}.opsi
|
local opsi_file=${PN}_${VERSION}-${release_new}.opsi
|
||||||
pushd ${OUTPUT_DIR}
|
pushd ${OUTPUT_DIR}
|
||||||
rm -f ${opsi_file} ${OPSI_REPOS_FILE_PATTERN}.opsi
|
rm -f ${opsi_file} ${OPSI_REPOS_FILE_PATTERN}.opsi
|
||||||
opsi-makeproductfile -v $INST_DIR
|
LANG="C" opsi-makeproductfile -v $INST_DIR
|
||||||
builder_check_error "Building OPSI-package"
|
builder_check_error "Building OPSI-package"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
@ -24,6 +24,29 @@ function retrieve_file() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
# void extract_file (src, dst)
|
||||||
|
#
|
||||||
|
# Description: Extract a file
|
||||||
|
#
|
||||||
|
# Parameter
|
||||||
|
# src: source file to be used
|
||||||
|
# dst: path to extract the file
|
||||||
|
#
|
||||||
|
#############################################
|
||||||
|
function extract_file() {
|
||||||
|
local src=$1
|
||||||
|
local dst=$2
|
||||||
|
|
||||||
|
if [ "${EXTRACTWITH}" = "7zip" ]; then
|
||||||
|
7z x -o$dst $src
|
||||||
|
elif [ "${EXTRACTWITH}" = "unzip" ]; then
|
||||||
|
unzip $src -d $dst
|
||||||
|
else
|
||||||
|
7z x -o$dst $src
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
# check if method is available and call it
|
# check if method is available and call it
|
||||||
|
@ -12,6 +12,19 @@ ADVICE=""
|
|||||||
# Valid value: restrict | public
|
# Valid value: restrict | public
|
||||||
TYPE="public"
|
TYPE="public"
|
||||||
|
|
||||||
|
# EXTRACTWITH - defines the used programm for decompression
|
||||||
|
# Valid values: 7zip | unzip
|
||||||
|
# Default value: 7zip
|
||||||
|
# This Value is only usefull in combinnation with Variable INSTALL[INDEX]
|
||||||
|
# EXTRACTWITH="7zip"
|
||||||
|
|
||||||
|
# Begin Not Implemented ---
|
||||||
|
# DOWNLOADWITH - defines the used programm for download
|
||||||
|
# Valid values: wget | plowdown
|
||||||
|
# Default value: wget
|
||||||
|
# DOWNLOADWITH="wget"
|
||||||
|
# End Not Implemented ---
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# File object array
|
# File object array
|
||||||
@ -50,6 +63,23 @@ TYPE="public"
|
|||||||
# This parameter is ptional, default value: <not set>,
|
# This parameter is ptional, default value: <not set>,
|
||||||
# WINST[index]=itWESS
|
# WINST[index]=itWESS
|
||||||
#
|
#
|
||||||
|
#################
|
||||||
|
# Optional Array Elements
|
||||||
|
################
|
||||||
|
#
|
||||||
|
# - INSTALL Variabels:
|
||||||
|
# If you specify the INSTALL Array Element Builder expects that the specified FILE is a
|
||||||
|
# compressed archive and extract it.
|
||||||
|
# INSTALL[index]="libreoffice34.msi"
|
||||||
|
#
|
||||||
|
# - EXTRACTTO Variabels:
|
||||||
|
# This Variable only works in combination with INSTALL and forces the extraction
|
||||||
|
# to be done into the specified directory.
|
||||||
|
# This will result in the files to be extracted to ARCH/EXTRACTTO.
|
||||||
|
# This feature is mostly needed if a package includes more setup programms that are nemed the
|
||||||
|
# same. This way you place the setups into diffent dirs
|
||||||
|
# EXTRACTTO[index]="office"
|
||||||
|
#
|
||||||
|
|
||||||
FILE[0]="itWatchLogo.jpg"
|
FILE[0]="itWatchLogo.jpg"
|
||||||
SOURCE[0]="http://www.itwatch.de/logos/itWatchLogo.jpg"
|
SOURCE[0]="http://www.itwatch.de/logos/itWatchLogo.jpg"
|
||||||
|
Loading…
Reference in New Issue
Block a user