nyam.imagine/builder-targets-cb.sh
2013-05-07 22:32:11 +02:00

135 lines
7.0 KiB
Bash

##############################################################################
# This optional file "builder-targets-cb.sh" will be called by builder.sh
#
# The targets will be called from thde opsi-builder using the following
# order: config, prepare, retrieve, create, package, publish, commit, cleanup
# You can overwrite the target functions in builder-targets-cb.sh
#
# You can define callback functions. The functions are called from
# opsi-builder within processing a target
# cb_package_makeproductfile
#
# You can use every variable defined in any configuration file or by
# the defined builder script itself. Also, calling the predefined
# targets builder_<targetname> is possible.
#
# Abstract:
# target order: config, prepare, retrieve, create, package, publish, commit, cleanup
# callbacks: <none>
#
##############################################################################
function cleanup() {
echo "Cleanup"
builder_cleanup
}
function create() {
echo "Create"
builder_create
cp $INST_DIR/CLIENT_DATA/opsi-${PN}.ini $INST_DIR/CLIENT_DATA/Imagine.ini
mkdir $INST_DIR/CLIENT_DATA/X86/Icons
mkdir $INST_DIR/CLIENT_DATA/X86_64/Icons
mkdir $INST_DIR/CLIENT_DATA/ALL/Icons
pushd $INST_DIR/CLIENT_DATA/ALL/
for type in ${WINST_VALUE[0]}
do
### 24bit #############################################################################################################################################
# 256x256
convert -size 256x256 xc:transparent -font DejaVu-Sans-Condensed-Bold -pointsize 70 -fill white -draw "gravity south text 0,5 '$type'" $type-256x256-txt.png
composite -quality 100 $type-256x256-txt.png $INST_DIR/CLIENT_DATA/ALL/tmpicon/icon_imagine_24bit_256x256.png $type-256x256-24bit.png
# 180x180
convert -resize 180x180 $type-256x256-24bit.png $type-180x180-24bit.png
# 150x150
convert -resize 150x150 $type-256x256-24bit.png $type-150x150-24bit.png
# 128x128
convert -size 128x128 xc:transparent -font DejaVu-Sans-Condensed-Bold -pointsize 37 -fill white -draw "gravity south text 0,2 '$type'" $type-128x128-txt.png
composite -quality 100 $type-128x128-txt.png $INST_DIR/CLIENT_DATA/ALL/tmpicon/icon_imagine_24bit_128x128.png $type-128x128-24bit.png
# 96x96
convert -resize 96x96 $type-256x256-24bit.png $type-96x96-24bit.png
# 72x72
convert -resize 72x72 $type-256x256-24bit.png $type-72x72-24bit.png
# 64x64
convert -size 64x64 xc:transparent -font DejaVu-Sans-Condensed-Bold -pointsize 19 -fill white -draw "gravity south text 0,1 '$type'" $type-64x64-txt.png
composite -quality 100 $type-64x64-txt.png $INST_DIR/CLIENT_DATA/ALL/tmpicon/icon_imagine_24bit_64x64.png $type-64x64-24bit.png
# 48x48
convert -size 48x48 xc:transparent -font DejaVu-Sans-Condensed-Bold -pointsize 14 -fill white -draw "gravity south text 0,1 '$type'" $type-48x48-txt.png
composite -quality 100 $type-48x48-txt.png $INST_DIR/CLIENT_DATA/ALL/tmpicon/icon_imagine_24bit_48x48.png $type-48x48-24bit.png
# 32x32
convert -resize 32x32 $type-48x48-24bit.png $type-32x32-24bit.png
# 30x30
convert -resize 30x30 $type-48x48-24bit.png $type-30x30-24bit.png
# 24x24
convert -resize 24x24 $type-48x48-24bit.png $type-24x24-24bit.png
# 16x16
#convert -size 16x16 xc:transparent -font DejaVu-Sans-Condensed-Bold -pointsize 7 -fill white -draw "gravity south text 0,0 '$type'" $type-16x16-txt.png
#composite -quality 100 $type-16x16-txt.png $INST_DIR/CLIENT_DATA/ALL/tmpicon/icon_imagine_24bit_16x16.png $type-16x16.png
convert -resize 16x16 $type-48x48-24bit.png $type-16x16-24bit.png
#### 8bit #############################################################################################################################################
# 256x256
convert $type-256x256-24bit.png -depth 8 -colors 256 +dither png8:$type-256x256-8bit.png
# 180x180
convert $type-180x180-24bit.png -depth 8 -colors 256 +dither png8:$type-180x180-8bit.png
# 150x150
convert $type-150x150-24bit.png -depth 8 -colors 256 +dither png8:$type-150x150-8bit.png
# 128x128
convert $type-128x128-24bit.png -depth 8 -colors 256 +dither png8:$type-128x128-8bit.png
# 96x96
convert $type-96x96-24bit.png -depth 8 -colors 256 +dither png8:$type-96x96-8bit.png
# 72x72
convert $type-72x72-24bit.png -depth 8 -colors 256 +dither png8:$type-72x72-8bit.png
# 64x64
convert $type-64x64-24bit.png -depth 8 -colors 256 +dither png8:$type-64x64-8bit.png
# 48x48
convert $type-48x48-24bit.png -depth 8 -colors 256 +dither png8:$type-48x48-8bit.png
# 32x32
convert $type-32x32-24bit.png -depth 8 -colors 256 +dither png8:$type-32x32-8bit.png
# 30x30
convert $type-30x30-24bit.png -depth 8 -colors 256 +dither png8:$type-30x30-8bit.png
# 24x24
convert $type-24x24-24bit.png -depth 8 -colors 256 +dither png8:$type-24x24-8bit.png
# 16x16
convert $type-16x16-24bit.png -depth 8 -colors 256 +dither png8:$type-16x16-8bit.png
#### 4bit #############################################################################################################################################
# 256x256
convert $type-256x256-8bit.png -colors 16 +dither $type-256x256-4bit.png
# 180x180
convert $type-180x180-8bit.png -colors 16 +dither $type-180x180-4bit.png
# 150x150
convert $type-150x150-8bit.png -colors 16 +dither $type-150x150-4bit.png
# 128x128
convert $type-128x128-8bit.png -colors 16 +dither $type-128x128-4bit.png
# 96x96
convert $type-96x96-8bit.png -colors 16 +dither $type-96x96-4bit.png
# 72x72
convert $type-72x72-8bit.png -colors 16 +dither $type-72x72-4bit.png
# 64x64
convert $type-64x64-8bit.png -colors 16 +dither $type-64x64-4bit.png
# 48x48
convert $type-48x48-8bit.png -colors 16 +dither $type-48x48-4bit.png
# 32x32
convert $type-32x32-8bit.png -colors 16 +dither $type-32x32-4bit.png
# 30x30
convert $type-30x30-8bit.png -colors 16 +dither $type-30x30-4bit.png
# 24x24
convert $type-24x24-8bit.png -colors 16 +dither $type-24x24-4bit.png
# 16x16
convert $type-16x16-8bit.png -colors 16 +dither $type-16x16-4bit.png
# combine the images into a icon
icotool -c -o $INST_DIR/CLIENT_DATA/ALL/Icons/$type.ico $type-256x256-24bit.png $type-180x180-24bit.png $type-150x150-24bit.png $type-128x128-24bit.png $type-96x96-24bit.png $type-72x72-24bit.png $type-64x64-24bit.png $type-48x48-24bit.png $type-32x32-24bit.png $type-30x30-24bit.png $type-24x24-24bit.png $type-16x16-24bit.png \
$type-256x256-8bit.png $type-180x180-8bit.png $type-150x150-8bit.png $type-128x128-8bit.png $type-96x96-8bit.png $type-72x72-8bit.png $type-64x64-8bit.png $type-48x48-8bit.png $type-32x32-8bit.png $type-30x30-8bit.png $type-24x24-8bit.png $type-16x16-8bit.png \
$type-256x256-4bit.png $type-180x180-4bit.png $type-150x150-4bit.png $type-128x128-4bit.png $type-96x96-4bit.png $type-72x72-4bit.png $type-64x64-4bit.png $type-48x48-4bit.png $type-32x32-4bit.png $type-30x30-4bit.png $type-24x24-4bit.png $type-16x16-4bit.png
done
popd
cp $INST_DIR/CLIENT_DATA/ALL/Icons/*.ico $INST_DIR/CLIENT_DATA/X86/Icons
cp $INST_DIR/CLIENT_DATA/ALL/Icons/*.ico $INST_DIR/CLIENT_DATA/X86_64/Icons
# rm -rf $INST_DIR/CLIENT_DATA/ALL/
}