diff --git a/windows-installer/build-windows-installer.sh b/windows-installer/build-windows-installer.sh new file mode 100755 index 0000000000000000000000000000000000000000..ee5cd580c2c7d9f20d142cc933b55bebbce6f59a --- /dev/null +++ b/windows-installer/build-windows-installer.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre +# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR +# +# This file is part of collect-agent +# +# collect-agent is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. + +AGENTVERSION="1.0.1" +AGENT="windows-agent/ProInfoData.exe" +AGENT_FILES="$(dirname $0)/windows-agent" +INEP=$1 + +# Ensure proxy variables are empty +PHOST= +PPORT= +PUID= +PPASSWD= + +# If the parameter isn't quotation marks, add its value to the respective proxy +# information variable +test "$2" = '""' || PHOST=$2 +test "$3" = '""' || PPORT=$3 +test "$4" = '""' || PUID=$4 +test "$5" = '""' || PPASSWD=$5 + +# Check if $INEP is empty +if test -z "${INEP}"; then + printf "ERROR (1): Empty INEP.\n" + exit 1 +fi + +mkdir -p "/tmp/${INEP}" + +# Copy the agent files to the temporary directory where the installation package +# will be generated +if ! cp -r "${AGENT_FILES}" "/tmp/${INEP}/"; then + printf "ERROR (2): Failed to copy agent files.\n" + exit 2 +fi + +printf "Creating conf files...\n" + +# Create the proxy and inep files with all necessary proxy information, and its md5 +echo "${INEP}" > "/tmp/${INEP}/inep" +echo "phost=$PHOST" > "/tmp/${INEP}/proxy" +echo "pport=$PPORT" >> "/tmp/${INEP}/proxy" +echo "puid=$PUID" >> "/tmp/${INEP}/proxy" +echo "ppasswd=$PPASSWD" >> "/tmp/${INEP}/proxy" + +cd "/tmp/${INEP}" + +printf "Packaging...\n" + +mv $AGENT ProInfoData.exe + +7z a -y data.7z ProInfoData.exe inep proxy +echo ";!@Install@!UTF-8! \ +Title=\"Software Installation\" \ +ExecuteFile=\"ProInfoData.exe\" \ +;!@InstallEnd@!\" " > 7zip.conf + +if test -f "windows-agent/7zS.sfx"; then + cat "windows-agent/7zS.sfx" 7zip.conf data.7z > "ProInfoData-${INEP}.exe" +else + printf "ERROR (3): Missing 7zS.sfx file\n" + exit 3 +fi + +printf "Removing temporary files...\n" + +mv "ProInfoData-${INEP}.exe" "/tmp" + +cd .. +rm -rf "${INEP}" 2> /dev/null + +printf "\nAll done.\n"