Skip to content

Commit f036f5b

Browse files
committed
automatically update resources of EXE application bundles during the build process
1 parent da2898d commit f036f5b

16 files changed

Lines changed: 156 additions & 26 deletions

release/bundle-windows.sh

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,67 @@ STAFF_TOOL="StaffSupportTool"
2020
CUSTOMER_TOOL="CustomerSupportTool"
2121
VERSION="1.1-SNAPSHOT"
2222

23-
SEVENZIP="7z"
23+
WINE="$(which "wine")"
24+
WINEPATH="$(which "winepath")"
25+
SEVENZIP="$(which "7z")"
2426
SEVENZIP_OPTIONS="-mx=9"
27+
2528
DIR=$( cd $( dirname ${BASH_SOURCE[0]} ) && pwd )
2629
TARGET_DIR="$DIR/target"
2730
FOUND="0"
2831
set -e
2932

33+
CUSTOMER_SFX="$DIR/src/windows/7zSD.sfx"
34+
STAFF_SFX="$DIR/src/windows/7zSD.sfx"
35+
if [[ -x "$WINE" ]]; then
36+
echo ""
37+
printf "\e[1m\e[92m=======================================================================\e[0m\n"
38+
printf "\e[1m\e[92m Creating custom 7zip sfx files...\e[0m\n"
39+
printf "\e[1m\e[92m=======================================================================\e[0m\n"
40+
echo ""
41+
42+
echo "Preparing build..."
43+
SEVENZIP_DIR="$TARGET_DIR/7zip"
44+
SEVENZIP_DIR_WIN="$("$WINEPATH" -w "$SEVENZIP_DIR")"
45+
rm -Rf "$SEVENZIP_DIR"
46+
mkdir -p "$SEVENZIP_DIR"
47+
cd "$DIR/src/windows"
48+
cp "7zSD.sfx" "$SEVENZIP_DIR"
49+
"$WINE" "ResourceHacker.exe" -open "manifest.rc" -save "$SEVENZIP_DIR_WIN\manifest.res" -action compile
50+
51+
echo "Creating Customer.sfx..."
52+
cp "$DIR/src/windows/Customer.script" "$SEVENZIP_DIR"
53+
if [[ -f "$DIR/src/windows/Customer.ico" ]]; then
54+
cp "$DIR/src/windows/Customer.ico" "$SEVENZIP_DIR"
55+
else
56+
cp "$DIR/../share/icons/desktopshare.ico" "$SEVENZIP_DIR/Customer.ico"
57+
fi
58+
"$WINE" "ResourceHacker.exe" -open "Customer.rc" -save "$SEVENZIP_DIR_WIN\Customer.res" -action compile
59+
"$WINE" "ResourceHacker.exe" -script "$SEVENZIP_DIR_WIN\Customer.script"
60+
if [[ -f "$SEVENZIP_DIR/Customer.sfx" ]]; then
61+
CUSTOMER_SFX="$SEVENZIP_DIR/Customer.sfx"
62+
else
63+
echo "WARNING: Customer.sfx was not created!"
64+
echo "Using default 7zSD.sfx instead."
65+
fi
66+
67+
echo "Creating Staff.sfx..."
68+
cp "$DIR/src/windows/Staff.script" "$SEVENZIP_DIR"
69+
if [[ -f "$DIR/src/windows/Staff.ico" ]]; then
70+
cp "$DIR/src/windows/Staff.ico" "$SEVENZIP_DIR"
71+
else
72+
cp "$DIR/../share/icons/help.ico" "$SEVENZIP_DIR/Staff.ico"
73+
fi
74+
"$WINE" "ResourceHacker.exe" -open "Staff.rc" -save "$SEVENZIP_DIR_WIN\Staff.res" -action compile
75+
"$WINE" "ResourceHacker.exe" -script "$SEVENZIP_DIR_WIN\Staff.script"
76+
if [[ -f "$SEVENZIP_DIR/Staff.sfx" ]]; then
77+
STAFF_SFX="$SEVENZIP_DIR/Staff.sfx"
78+
else
79+
echo "WARNING: Staff.sfx was not created!"
80+
echo "Using default 7zSD.sfx instead."
81+
fi
82+
fi
83+
3084
if [[ -d "$TARGET_DIR/Staff/windows-x86" ]]; then
3185
FOUND="1"
3286
echo ""
@@ -37,7 +91,7 @@ if [[ -d "$TARGET_DIR/Staff/windows-x86" ]]; then
3791
cd "$TARGET_DIR/Staff/windows-x86"
3892
"$SEVENZIP" a "$SEVENZIP_OPTIONS" \
3993
"$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86.7z" .
40-
cat "$DIR/src/windows/Staff.sfx" > "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86.exe"
94+
cat "$STAFF_SFX" > "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86.exe"
4195
cat "$DIR/src/windows/Staff.txt" >> "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86.exe"
4296
cat "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86.7z" >> "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86.exe"
4397
rm "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86.7z"
@@ -53,7 +107,7 @@ if [[ -d "$TARGET_DIR/Staff/windows-x86-64" ]]; then
53107
cd "$TARGET_DIR/Staff/windows-x86-64"
54108
"$SEVENZIP" a "$SEVENZIP_OPTIONS" \
55109
"$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86-64.7z" .
56-
cat "$DIR/src/windows/Staff.sfx" > "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86-64.exe"
110+
cat "$STAFF_SFX" > "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86-64.exe"
57111
cat "$DIR/src/windows/Staff.txt" >> "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86-64.exe"
58112
cat "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86-64.7z" >> "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86-64.exe"
59113
rm "$TARGET_DIR/$STAFF_TOOL-$VERSION.windows-x86-64.7z"
@@ -69,7 +123,7 @@ if [[ -d "$TARGET_DIR/Customer/windows-x86" ]]; then
69123
cd "$TARGET_DIR/Customer/windows-x86"
70124
"$SEVENZIP" a "$SEVENZIP_OPTIONS" \
71125
"$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86.7z" .
72-
cat "$DIR/src/windows/Customer.sfx" > "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86.exe"
126+
cat "$CUSTOMER_SFX" > "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86.exe"
73127
cat "$DIR/src/windows/Customer.txt" >> "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86.exe"
74128
cat "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86.7z" >> "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86.exe"
75129
rm "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86.7z"
@@ -85,7 +139,7 @@ if [[ -d "$TARGET_DIR/Customer/windows-x86-64" ]]; then
85139
cd "$TARGET_DIR/Customer/windows-x86-64"
86140
"$SEVENZIP" a "$SEVENZIP_OPTIONS" \
87141
"$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86-64.7z" .
88-
cat "$DIR/src/windows/Customer.sfx" > "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86-64.exe"
142+
cat "$CUSTOMER_SFX" > "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86-64.exe"
89143
cat "$DIR/src/windows/Customer.txt" >> "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86-64.exe"
90144
cat "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86-64.7z" >> "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86-64.exe"
91145
rm "$TARGET_DIR/$CUSTOMER_TOOL-$VERSION.windows-x86-64.7z"

release/src/7zip/7zSD.sfx

-122 KB
Binary file not shown.

release/src/7zip/README.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

release/src/7zip/manifest.res

-492 Bytes
Binary file not shown.

release/src/windows/.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
*.rc text eol=crlf
2+
*.script text eol=crlf
13
*.txt text eol=lf

release/src/windows/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.ini

release/src/windows/7zSD.sfx

122 KB
Binary file not shown.

release/src/windows/Customer.rc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
1 VERSIONINFO
3+
FILEVERSION 1,1,0,0
4+
PRODUCTVERSION 1,1,0,0
5+
FILEOS 0x40004
6+
FILETYPE 0x1
7+
{
8+
BLOCK "StringFileInfo"
9+
{
10+
BLOCK "040904B0"
11+
{
12+
VALUE "CompanyName", "OpenIndex.de"
13+
VALUE "FileDescription", "Remote Support Tool for customers"
14+
VALUE "FileVersion", "1.1.0"
15+
VALUE "InternalName", "CustomerSupportTool.exe"
16+
VALUE "LegalCopyright", "Copyright (c) 2015-2019 OpenIndex.de"
17+
VALUE "OriginalFilename", "CustomerSupportTool.exe"
18+
VALUE "ProductName", "Customer Support Tool"
19+
VALUE "ProductVersion", "1.1.0"
20+
}
21+
}
22+
23+
BLOCK "VarFileInfo"
24+
{
25+
VALUE "Translation", 0x0409 0x04B0
26+
}
27+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[FILENAMES]
2+
Exe= 7zSD.sfx
3+
SaveAs= Customer.sfx
4+
Log= CONSOLE
5+
6+
[COMMANDS]
7+
-addoverwrite Customer.ico, ICONGROUP,1,1033
8+
-modify Customer.res, VERSIONINFO,1,1033
9+
-add manifest.res, MANIFEST,,0

release/src/windows/Customer.sfx

-155 KB
Binary file not shown.

0 commit comments

Comments
 (0)