diff --git a/Perl/Scripts/install-perl-modules-and-dependencies.sh b/Perl/Scripts/install-perl-modules-and-dependencies.sh index a4abf60..82d0598 100755 --- a/Perl/Scripts/install-perl-modules-and-dependencies.sh +++ b/Perl/Scripts/install-perl-modules-and-dependencies.sh @@ -59,6 +59,8 @@ declare -r tr=$(type -P tr) declare -r uniq=$(type -P uniq) declare -r find=$(type -P find) declare -r cp=$(type -P cp) +declare -r curl=$(type -P curl) +declare -r p7z=$(type -P 7z) # Check the OS if [ "${MSYSTEM}" = "MSYS" ]; then @@ -134,6 +136,43 @@ fusinv_mod_specific_dependences="$(echo ${fusinv_agent_mod_specific_dependences} ${tr} '\n' ' ')" fusinv_mod_specific_dependences="${fusinv_mod_specific_dependences% *}" +# Download winpcap as need to install Net::Pcap perl module +echo "Downloading WinPcap SDK..." +eval ${curl} --silent --location --max-redirs 6 --output "/tmp/${winpcap_sdk}" \ + "${winpcap_url}" +if [ ! -e "/tmp/${winpcap_sdk}" ]; then + echo "Failed to download winpcap SDK" + exit 4 +fi +# WinPcap installation for x86 +for arch in ${archs[@]}; do + # Extract archive + eval ${p7z} x -bd -y -o"${strawberry_arch_path}" "/tmp/${winpcap_sdk}" + if (( $? == 0 )); then + echo "Done and extracted!" + else + echo "Failure!" + echo + eval echo "There has been an error decompressing \'${winpcap_sdk}\'." + echo + eval echo -n "Perhaps the URL \'${winpcap_url}\' is incorrect.\ " + echo -n "Please, check the variable '${winpcap_url}' in the 'load-perl-environment' " + echo "file, and try again." + exit 5 + fi + # Prepare Netpcap libs + if [ "${arch}" == "x64" ]; then + eval "${strawberry_arch_path}/c/bin/gendef.exe" - C:/Windows/system32/wpcap.dll > wpcap.def + eval "${strawberry_arch_path}/c/bin/dlltool.exe" --as-flags=--64 -m i386:x86-64 -k --output-lib libwpcap.a --input-def wpcap.def + eval ${cp} -avf "libwpcap.a" "${strawberry_arch_path}/c/Lib/libwpcap.a" + else + eval ${cp} -avf "${strawberry_arch_path}/WpdPack/Lib/libwpcap.a" "${strawberry_arch_path}/c/Lib/libwpcap.a" + fi + eval ${cp} -avf "${strawberry_arch_path}/WpdPack/Include/*" "${strawberry_arch_path}/c/include" +done +eval ${rm} -f "/tmp/${winpcap_sdk}" > /dev/null 2>&1 +echo + # Installation loop while (( ${iter} < ${#archs[@]} )); do # Set arch and arch_label @@ -163,7 +202,9 @@ while (( ${iter} < ${#archs[@]} )); do # Install specific modules if [ -n "${fusinv_mod_specific_dependences}" ]; then echo "Installing specific modules..." - ${perl} ${cpanm} --install --auto-cleanup 0 --no-man-pages --skip-installed --notest --quiet ${fusinv_mod_specific_dependences} + ${perl} ${cpanm} --install --auto-cleanup 0 --no-man-pages --skip-installed --notest ${fusinv_mod_specific_dependences} + echo "Keeping perl ${strawberry_version}-${arch_label}s modules build log..." + eval ${cp} -av "$(pwd)/${strawberry_arch_path}/data/.cpanm/build.log" "$(pwd)/${strawberry_path}/../build-specific-${arch_label}s.log" fi # Install modules diff --git a/Perl/Scripts/load-perl-environment b/Perl/Scripts/load-perl-environment index b2d41d6..c304f45 100644 --- a/Perl/Scripts/load-perl-environment +++ b/Perl/Scripts/load-perl-environment @@ -54,13 +54,16 @@ declare -r strawberry_arch_path='${strawberry_path}/${arch}' declare -r strawberry_arch_url='http://strawberryperl.com/download/${strawberry_version}/strawberry-perl-${strawberry_version}-${arch_label}-portable.zip' declare -r strawberry_pepfia_branch='2.5.x' -declare -r strawberry_pepfia_build_id='1' +declare -r strawberry_pepfia_build_id='2' declare -r strawberry_pepfia_path="${strawberry_path%/${strawberry_version}}" declare -r strawberry_pepfia_file="strawberry-perl-${strawberry_version}-all-pepfia-${strawberry_pepfia_branch}-${strawberry_pepfia_build_id}.tar.xz" declare -r strawberry_pepfia_par_file='strawberry-perl-${strawberry_version}-${arch}-par-pepfia-${strawberry_pepfia_branch}-${strawberry_pepfia_build_id}.zip' declare -r strawberry_pepfia_par_template_file='fusioninventory-agent-par-template.pl' declare -r strawberry_pepfia_url='https://sourceforge.net/projects/fiawi/files/strawberry-perl-packages' +declare -r winpcap_sdk='WpdPack_4_1_2.zip' +declare -r winpcap_url="https://www.winpcap.org/install/bin/${winpcap_sdk}" + declare -i -r maximum_commit_length=10 # Set fusinv_agent_commit to a release tag to generate a release @@ -93,8 +96,9 @@ fi declare -r fusinv_agent_mod_name='fusioninventory-agent' declare -r fusinv_agent_repository='https://github.com/TECLIB/fusioninventory-agent.git' -declare -r fusinv_agent_mod_specific_dependences='' -declare -r fusinv_agent_mod_dependences='Archive::Extract Compress::Zlib DateTime Digest::SHA File::Copy::Recursive File::Which HTTP::Daemon inc::Module::Install IO::Socket::SSL JSON::PP LWP::Protocol::https LWP::UserAgent Net::IP Net::NBName Net::Ping Net::SNMP Parallel::ForkManager Parse::EDID Text::Template Thread::Queue UNIVERSAL::require URI::Escape Win32::Daemon Win32::Job Win32::OLE Win32::TieRegistry Win32::Unicode::File XML::TreePP' +# We need a fixed Net::Pcap module +declare -r fusinv_agent_mod_specific_dependences='git://github.com/g-bougard/Net-Pcap.git' +declare -r fusinv_agent_mod_dependences='Archive::Extract Compress::Zlib DateTime Digest::SHA File::Copy::Recursive File::Which HTTP::Daemon inc::Module::Install IO::Socket::SSL JSON::PP LWP::Protocol::https LWP::UserAgent Net::IP Net::NBName Net::Ping Net::SNMP Net::Write::Layer2 Parallel::ForkManager Parse::EDID Text::Template Thread::Queue UNIVERSAL::require URI::Escape Win32::Daemon Win32::Job Win32::OLE Win32::TieRegistry Win32::Unicode::File XML::TreePP' declare -r fusinv_agent_mod_uses='base Config constant Crypt::DES Crypt::Rijndael Cwd Data::Dumper Digest::MD5 Encode Encode::Byte Encode::CN Encode::JP Encode::KR Encode::TW Encode::Unicode English Fcntl File::Basename File::Find File::Glob File::Path File::Spec File::stat File::Temp Getopt::Long HTTP::Cookies HTTP::Headers HTTP::Request HTTP::Status integer IO::Handle lib LWP Memoize MIME::Base64 Net::Domain Net::hostent Net::HTTPS Net::SNMP::Security::USM Net::SNMP::Transport::IPv4::TCP Net::SNMP::Transport::IPv6::TCP Net::SNMP::Transport::IPv6::UDP Pod::Usage POSIX Scalar::Util Socket Storable strict Sys::Hostname Sys::Syslog Thread::Semaphore threads threads::shared Tie::Hash::NamedCapture Time::HiRes Time::Local Time::localtime URI User::pwent utf8 warnings Win32 Win32::API Win32::OLE::Const Win32::OLE::Variant' declare -r fusinv_agent_mod_dependences_for_test='HTTP::Proxy HTTP::Server::Simple HTTP::Server::Simple::Authen IO::Capture::Stderr IPC::Run Test::Compile Test::Deep Test::Exception Test::MockModule Test::MockObject Test::More Test::NoWarnings' diff --git a/appveyor.yml b/appveyor.yml index 45cd77c..1c6e1de 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,6 +10,7 @@ notifications: on_build_status_changed: true install: + - choco install winpcap - cd Perl\Scripts - .\install-gnu-utilities-collection.bat - .\update-gnu-utilities-collection.bat @@ -25,7 +26,7 @@ build_script: - dir Perl\Strawberry artifacts: - - path: NSIS/*.txt,Perl/Scripts/*.log + - path: Perl/Strawberry/*.log name: logs - path: Perl/Strawberry/*.xz name: archives