From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- setup_native/CustomTarget_mac.mk | 20 + setup_native/CustomTarget_scripts.mk | 38 + setup_native/CustomTarget_spell.mk | 17 + setup_native/Library_inst_msu_msi.mk | 40 + setup_native/Library_instooofiltmsi.mk | 38 + setup_native/Library_qslnkmsi.mk | 45 + setup_native/Library_reg4allmsdoc.mk | 42 + setup_native/Library_reg_dlls.mk | 40 + setup_native/Library_regactivex.mk | 38 + setup_native/Library_sdqsmsi.mk | 45 + setup_native/Library_sellangmsi.mk | 46 + setup_native/Library_shlxtmsi.mk | 53 + setup_native/Library_sn_tools.mk | 43 + setup_native/Makefile | 7 + setup_native/Module_setup_native.mk | 41 + setup_native/Package_misc.mk | 14 + setup_native/Package_packinfo.mk | 14 + setup_native/Package_scripts.mk | 14 + setup_native/StaticLibrary_quickstarter.mk | 24 + setup_native/StaticLibrary_seterror.mk | 24 + setup_native/scripts/admin.pl | 1244 ++++++++++++++++++++ setup_native/scripts/downloadscript.sh | 104 ++ setup_native/scripts/fake-db.spec | 57 + setup_native/scripts/install_create.pl | 60 + setup_native/scripts/install_linux.sh | 313 +++++ setup_native/scripts/langpackscript.sh | 170 +++ setup_native/scripts/mac_install.script | 27 + .../scripts/osx_install_languagepack.applescript | 175 +++ setup_native/scripts/uninstall_linux.sh | 72 ++ setup_native/scripts/unpack_update.sh | 50 + setup_native/source/mac/Info.plist.langpack | 53 + setup_native/source/mac/macinstall.ulf | 68 ++ setup_native/source/mac/ooo3_installer.icns | Bin 0 -> 42710 bytes setup_native/source/packinfo/DS_Store | Bin 0 -> 12292 bytes setup_native/source/packinfo/DS_Store_Dev | Bin 0 -> 12292 bytes setup_native/source/packinfo/DS_Store_Langpack | Bin 0 -> 12292 bytes setup_native/source/packinfo/finals_instsetoo.txt | 32 + setup_native/source/packinfo/libreoffice.pcp | Bin 0 -> 20480 bytes setup_native/source/packinfo/linuxcopyrightfile | 2 + .../source/packinfo/openofficelanguagepack.pcp | Bin 0 -> 6144 bytes setup_native/source/packinfo/osxdndinstall.png | Bin 0 -> 62596 bytes setup_native/source/packinfo/package.txt | 1 + setup_native/source/packinfo/package_names.txt | 65 + setup_native/source/packinfo/package_names_ext.txt | 21 + setup_native/source/packinfo/packinfo_brand.txt | 129 ++ .../source/packinfo/packinfo_extensions.txt | 140 +++ setup_native/source/packinfo/packinfo_office.txt | 1244 ++++++++++++++++++++ .../source/packinfo/packinfo_office_help.txt | 54 + .../source/packinfo/packinfo_office_lang.txt | 196 +++ setup_native/source/packinfo/packinfo_sdkoo.txt | 32 + setup_native/source/packinfo/packinfo_ure.txt | 49 + setup_native/source/packinfo/private1copyrightfile | 2 + setup_native/source/packinfo/solariscopyrightfile | 2 + .../source/packinfo/spellchecker_selection.pl | 74 ++ .../source/packinfo/spellchecker_selection.txt | 92 ++ setup_native/source/packinfo/ure.pcp | Bin 0 -> 6144 bytes .../indexingfilter/instooofiltmsi.def | 3 + .../indexingfilter/restartindexingservice.cxx | 157 +++ .../win32/customactions/inst_msu/inst_msu.cxx | 674 +++++++++++ .../win32/customactions/inst_msu/inst_msu_msi.def | 5 + .../win32/customactions/quickstarter/qslnkmsi.def | 3 + .../customactions/quickstarter/quickstarter.cxx | 131 +++ .../customactions/quickstarter/quickstarter.hxx | 36 + .../quickstarter/remove_quickstart_link.cxx | 42 + .../win32/customactions/quickstarter/sdqsmsi.def | 3 + .../quickstarter/shutdown_quickstart.cxx | 73 ++ .../customactions/reg4allmsdoc/reg4allmsdoc.def | 6 + .../customactions/reg4allmsdoc/reg4allmsi.cxx | 519 ++++++++ .../win32/customactions/reg_dlls/reg_dlls.cxx | 319 +++++ .../win32/customactions/reg_dlls/reg_dlls.def | 5 + .../win32/customactions/regactivex/regactivex.cxx | 344 ++++++ .../win32/customactions/regactivex/regactivex.def | 4 + .../source/win32/customactions/sellang/sellang.cxx | 387 ++++++ .../source/win32/customactions/sellang/sellang.def | 4 + .../win32/customactions/sellang/sorttree.cxx | 55 + .../shellextensions/checkdirectory.cxx | 66 ++ .../customactions/shellextensions/checkpatches.cxx | 59 + .../shellextensions/completeinstallpath.cxx | 116 ++ .../shellextensions/migrateinstallpath.cxx | 96 ++ .../customactions/shellextensions/shlxtmsi.def | 11 + .../customactions/shellextensions/shlxtmsi.hxx | 59 + .../shellextensions/startmenuicon.cxx | 63 + .../customactions/shellextensions/upgrade.cxx | 158 +++ .../customactions/shellextensions/vistaspecial.cxx | 126 ++ .../win32/customactions/tools/checkversion.cxx | 98 ++ .../source/win32/customactions/tools/seterror.cxx | 84 ++ .../source/win32/customactions/tools/seterror.hxx | 36 + .../source/win32/customactions/tools/sn_tools.def | 3 + setup_native/source/win32/desktophelper.txt | 1 + 89 files changed, 8917 insertions(+) create mode 100644 setup_native/CustomTarget_mac.mk create mode 100644 setup_native/CustomTarget_scripts.mk create mode 100644 setup_native/CustomTarget_spell.mk create mode 100644 setup_native/Library_inst_msu_msi.mk create mode 100644 setup_native/Library_instooofiltmsi.mk create mode 100644 setup_native/Library_qslnkmsi.mk create mode 100644 setup_native/Library_reg4allmsdoc.mk create mode 100644 setup_native/Library_reg_dlls.mk create mode 100644 setup_native/Library_regactivex.mk create mode 100644 setup_native/Library_sdqsmsi.mk create mode 100644 setup_native/Library_sellangmsi.mk create mode 100644 setup_native/Library_shlxtmsi.mk create mode 100644 setup_native/Library_sn_tools.mk create mode 100644 setup_native/Makefile create mode 100644 setup_native/Module_setup_native.mk create mode 100644 setup_native/Package_misc.mk create mode 100644 setup_native/Package_packinfo.mk create mode 100644 setup_native/Package_scripts.mk create mode 100644 setup_native/StaticLibrary_quickstarter.mk create mode 100644 setup_native/StaticLibrary_seterror.mk create mode 100644 setup_native/scripts/admin.pl create mode 100644 setup_native/scripts/downloadscript.sh create mode 100644 setup_native/scripts/fake-db.spec create mode 100644 setup_native/scripts/install_create.pl create mode 100644 setup_native/scripts/install_linux.sh create mode 100644 setup_native/scripts/langpackscript.sh create mode 100644 setup_native/scripts/mac_install.script create mode 100644 setup_native/scripts/osx_install_languagepack.applescript create mode 100644 setup_native/scripts/uninstall_linux.sh create mode 100644 setup_native/scripts/unpack_update.sh create mode 100644 setup_native/source/mac/Info.plist.langpack create mode 100644 setup_native/source/mac/macinstall.ulf create mode 100644 setup_native/source/mac/ooo3_installer.icns create mode 100644 setup_native/source/packinfo/DS_Store create mode 100644 setup_native/source/packinfo/DS_Store_Dev create mode 100644 setup_native/source/packinfo/DS_Store_Langpack create mode 100644 setup_native/source/packinfo/finals_instsetoo.txt create mode 100644 setup_native/source/packinfo/libreoffice.pcp create mode 100644 setup_native/source/packinfo/linuxcopyrightfile create mode 100644 setup_native/source/packinfo/openofficelanguagepack.pcp create mode 100644 setup_native/source/packinfo/osxdndinstall.png create mode 100644 setup_native/source/packinfo/package.txt create mode 100644 setup_native/source/packinfo/package_names.txt create mode 100644 setup_native/source/packinfo/package_names_ext.txt create mode 100644 setup_native/source/packinfo/packinfo_brand.txt create mode 100644 setup_native/source/packinfo/packinfo_extensions.txt create mode 100644 setup_native/source/packinfo/packinfo_office.txt create mode 100644 setup_native/source/packinfo/packinfo_office_help.txt create mode 100644 setup_native/source/packinfo/packinfo_office_lang.txt create mode 100644 setup_native/source/packinfo/packinfo_sdkoo.txt create mode 100644 setup_native/source/packinfo/packinfo_ure.txt create mode 100644 setup_native/source/packinfo/private1copyrightfile create mode 100644 setup_native/source/packinfo/solariscopyrightfile create mode 100644 setup_native/source/packinfo/spellchecker_selection.pl create mode 100644 setup_native/source/packinfo/spellchecker_selection.txt create mode 100644 setup_native/source/packinfo/ure.pcp create mode 100644 setup_native/source/win32/customactions/indexingfilter/instooofiltmsi.def create mode 100644 setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx create mode 100644 setup_native/source/win32/customactions/inst_msu/inst_msu.cxx create mode 100644 setup_native/source/win32/customactions/inst_msu/inst_msu_msi.def create mode 100644 setup_native/source/win32/customactions/quickstarter/qslnkmsi.def create mode 100644 setup_native/source/win32/customactions/quickstarter/quickstarter.cxx create mode 100644 setup_native/source/win32/customactions/quickstarter/quickstarter.hxx create mode 100644 setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx create mode 100644 setup_native/source/win32/customactions/quickstarter/sdqsmsi.def create mode 100644 setup_native/source/win32/customactions/quickstarter/shutdown_quickstart.cxx create mode 100644 setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsdoc.def create mode 100644 setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx create mode 100644 setup_native/source/win32/customactions/reg_dlls/reg_dlls.cxx create mode 100644 setup_native/source/win32/customactions/reg_dlls/reg_dlls.def create mode 100644 setup_native/source/win32/customactions/regactivex/regactivex.cxx create mode 100644 setup_native/source/win32/customactions/regactivex/regactivex.def create mode 100644 setup_native/source/win32/customactions/sellang/sellang.cxx create mode 100644 setup_native/source/win32/customactions/sellang/sellang.def create mode 100644 setup_native/source/win32/customactions/sellang/sorttree.cxx create mode 100644 setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx create mode 100644 setup_native/source/win32/customactions/shellextensions/checkpatches.cxx create mode 100644 setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx create mode 100644 setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx create mode 100644 setup_native/source/win32/customactions/shellextensions/shlxtmsi.def create mode 100644 setup_native/source/win32/customactions/shellextensions/shlxtmsi.hxx create mode 100644 setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx create mode 100644 setup_native/source/win32/customactions/shellextensions/upgrade.cxx create mode 100644 setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx create mode 100644 setup_native/source/win32/customactions/tools/checkversion.cxx create mode 100644 setup_native/source/win32/customactions/tools/seterror.cxx create mode 100644 setup_native/source/win32/customactions/tools/seterror.hxx create mode 100644 setup_native/source/win32/customactions/tools/sn_tools.def create mode 100644 setup_native/source/win32/desktophelper.txt (limited to 'setup_native') diff --git a/setup_native/CustomTarget_mac.mk b/setup_native/CustomTarget_mac.mk new file mode 100644 index 000000000..2f35f23cc --- /dev/null +++ b/setup_native/CustomTarget_mac.mk @@ -0,0 +1,20 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CustomTarget_CustomTarget,setup_native/mac)) + +$(eval $(call gb_CustomTarget_register_target,setup_native/mac,macinstall.ulf)) + +$(eval $(call gb_CustomTarget_ulfex_rule,\ + $(call gb_CustomTarget_get_workdir,setup_native/mac)/macinstall.ulf,\ + $(SRCDIR)/setup_native/source/mac/macinstall.ulf,\ + $(foreach lang,$(gb_TRANS_LANGS),\ + $(gb_POLOCATION)/$(lang)/setup_native/source/mac.po))) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/CustomTarget_scripts.mk b/setup_native/CustomTarget_scripts.mk new file mode 100644 index 000000000..c7f8c5b0a --- /dev/null +++ b/setup_native/CustomTarget_scripts.mk @@ -0,0 +1,38 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +scripts_WORKDIR :=$(call gb_CustomTarget_get_workdir,setup_native/scripts) + +$(eval $(call gb_CustomTarget_CustomTarget,setup_native/scripts)) + +ifeq ($(OS),LINUX) +ifneq ($(filter rpm,$(PKGFORMAT)),) +$(eval $(call gb_CustomTarget_register_targets,setup_native/scripts,\ + install \ + uninstall \ + noarch/fake-db-1.0-0.noarch.rpm \ +)) + +$(scripts_WORKDIR)/noarch/fake-db-1.0-0.noarch.rpm: $(SRCDIR)/setup_native/scripts/fake-db.spec + mkdir -p $(scripts_WORKDIR)/fake-db-root + $(RPM) --define "_builddir $(scripts_WORKDIR)/fake-db-root" \ + --define "_rpmdir $(scripts_WORKDIR)" -bb $< + chmod g+w $(scripts_WORKDIR)/fake-db-root + +$(scripts_WORKDIR)/install: $(SRCDIR)/setup_native/scripts/install_linux.sh $(scripts_WORKDIR)/noarch/fake-db-1.0-0.noarch.rpm + $(PERL) -w $(SRCDIR)/setup_native/scripts/install_create.pl $^ $@ + chmod 775 $@ + +$(scripts_WORKDIR)/uninstall: $(SRCDIR)/setup_native/scripts/uninstall_linux.sh + cat $< | tr -d "\015" > $@ + chmod 775 $@ +endif +endif + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/CustomTarget_spell.mk b/setup_native/CustomTarget_spell.mk new file mode 100644 index 000000000..b18095658 --- /dev/null +++ b/setup_native/CustomTarget_spell.mk @@ -0,0 +1,17 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CustomTarget_CustomTarget,setup_native/spell)) + +$(eval $(call gb_CustomTarget_register_target,setup_native/spell,spellchecker_selection.hxx)) + +$(call gb_CustomTarget_get_workdir,setup_native/spell)/spellchecker_selection.hxx: $(SRCDIR)/setup_native/source/packinfo/spellchecker_selection.txt $(SRCDIR)/setup_native/source/packinfo/spellchecker_selection.pl + $(PERL) -w $(SRCDIR)/setup_native/source/packinfo/spellchecker_selection.pl <$< >$@ + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_inst_msu_msi.mk b/setup_native/Library_inst_msu_msi.mk new file mode 100644 index 000000000..d423b5168 --- /dev/null +++ b/setup_native/Library_inst_msu_msi.mk @@ -0,0 +1,40 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,inst_msu_msi)) + +$(eval $(call gb_Library_add_defs,inst_msu_msi,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,inst_msu_msi,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,inst_msu_msi,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/inst_msu/inst_msu_msi.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,inst_msu_msi,\ + setup_native/source/win32/customactions/inst_msu/inst_msu \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,inst_msu_msi,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + kernel32 \ + Ole32 \ + Shell32 \ + Msi \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_instooofiltmsi.mk b/setup_native/Library_instooofiltmsi.mk new file mode 100644 index 000000000..36e2e2a6b --- /dev/null +++ b/setup_native/Library_instooofiltmsi.mk @@ -0,0 +1,38 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,instooofiltmsi)) + +$(eval $(call gb_Library_add_defs,instooofiltmsi,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,instooofiltmsi,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,instooofiltmsi,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/indexingfilter/instooofiltmsi.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,instooofiltmsi,\ + setup_native/source/win32/customactions/indexingfilter/restartindexingservice \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,instooofiltmsi,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + kernel32 \ + advapi32 \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_qslnkmsi.mk b/setup_native/Library_qslnkmsi.mk new file mode 100644 index 000000000..f958534f0 --- /dev/null +++ b/setup_native/Library_qslnkmsi.mk @@ -0,0 +1,45 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,qslnkmsi)) + +$(eval $(call gb_Library_add_defs,qslnkmsi,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,qslnkmsi,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,qslnkmsi,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/quickstarter/qslnkmsi.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,qslnkmsi,\ + setup_native/source/win32/customactions/quickstarter/remove_quickstart_link \ +)) + +$(eval $(call gb_Library_use_static_libraries,qslnkmsi,\ + quickstarter \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,qslnkmsi,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + msi \ + kernel32 \ + user32 \ + advapi32 \ + shell32 \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_reg4allmsdoc.mk b/setup_native/Library_reg4allmsdoc.mk new file mode 100644 index 000000000..816ebbb3f --- /dev/null +++ b/setup_native/Library_reg4allmsdoc.mk @@ -0,0 +1,42 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,reg4allmsdoc)) + +$(eval $(call gb_Library_add_defs,reg4allmsdoc,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,reg4allmsdoc,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,reg4allmsdoc,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsdoc.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,reg4allmsdoc,\ + setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,reg4allmsdoc,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + msi \ + kernel32 \ + user32 \ + advapi32 \ + shell32 \ + shlwapi \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_reg_dlls.mk b/setup_native/Library_reg_dlls.mk new file mode 100644 index 000000000..f0ac9a875 --- /dev/null +++ b/setup_native/Library_reg_dlls.mk @@ -0,0 +1,40 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,reg_dlls)) + +$(eval $(call gb_Library_add_defs,reg_dlls,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,reg_dlls,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,reg_dlls,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/reg_dlls/reg_dlls.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,reg_dlls,\ + setup_native/source/win32/customactions/reg_dlls/reg_dlls \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,reg_dlls,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + kernel32 \ + Ole32 \ + Shell32 \ + Msi \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_regactivex.mk b/setup_native/Library_regactivex.mk new file mode 100644 index 000000000..7142b8ee0 --- /dev/null +++ b/setup_native/Library_regactivex.mk @@ -0,0 +1,38 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,regactivex)) + +$(eval $(call gb_Library_add_defs,regactivex,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,regactivex,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,regactivex,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/regactivex/regactivex.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,regactivex,\ + setup_native/source/win32/customactions/regactivex/regactivex \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,regactivex,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + kernel32 \ + msi \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_sdqsmsi.mk b/setup_native/Library_sdqsmsi.mk new file mode 100644 index 000000000..ff9a1bd58 --- /dev/null +++ b/setup_native/Library_sdqsmsi.mk @@ -0,0 +1,45 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,sdqsmsi)) + +$(eval $(call gb_Library_add_defs,sdqsmsi,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,sdqsmsi,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,sdqsmsi,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/quickstarter/sdqsmsi.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,sdqsmsi,\ + setup_native/source/win32/customactions/quickstarter/shutdown_quickstart \ +)) + +$(eval $(call gb_Library_use_static_libraries,sdqsmsi,\ + quickstarter \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,sdqsmsi,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + msi \ + kernel32 \ + user32 \ + advapi32 \ + shell32 \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_sellangmsi.mk b/setup_native/Library_sellangmsi.mk new file mode 100644 index 000000000..04f8f6edb --- /dev/null +++ b/setup_native/Library_sellangmsi.mk @@ -0,0 +1,46 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,sellangmsi)) + +$(eval $(call gb_Library_use_custom_headers,sellangmsi,\ + setup_native/spell \ +)) + +$(eval $(call gb_Library_add_defs,sellangmsi,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,sellangmsi,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,sellangmsi,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/sellang/sellang.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,sellangmsi,\ + setup_native/source/win32/customactions/sellang/sellang \ + setup_native/source/win32/customactions/sellang/sorttree \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,sellangmsi,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + msi \ + kernel32 \ + user32 \ + advapi32 \ + shell32 \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_shlxtmsi.mk b/setup_native/Library_shlxtmsi.mk new file mode 100644 index 000000000..a4c2fccd2 --- /dev/null +++ b/setup_native/Library_shlxtmsi.mk @@ -0,0 +1,53 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,shlxtmsi)) + +$(eval $(call gb_Library_use_external,shlxtmsi,boost_headers)) + +$(eval $(call gb_Library_add_defs,shlxtmsi,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,shlxtmsi,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,shlxtmsi,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/shellextensions/shlxtmsi.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,shlxtmsi,\ + setup_native/source/win32/customactions/shellextensions/startmenuicon \ + setup_native/source/win32/customactions/shellextensions/upgrade \ + setup_native/source/win32/customactions/shellextensions/migrateinstallpath \ + setup_native/source/win32/customactions/shellextensions/completeinstallpath \ + setup_native/source/win32/customactions/shellextensions/checkdirectory \ + setup_native/source/win32/customactions/shellextensions/vistaspecial \ + setup_native/source/win32/customactions/shellextensions/checkpatches \ +)) + +$(eval $(call gb_Library_use_static_libraries,shlxtmsi,\ + seterror \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,shlxtmsi,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + msi \ + kernel32 \ + advapi32 \ + shell32 \ + psapi \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Library_sn_tools.mk b/setup_native/Library_sn_tools.mk new file mode 100644 index 000000000..aa94f2ebc --- /dev/null +++ b/setup_native/Library_sn_tools.mk @@ -0,0 +1,43 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,sn_tools)) + +$(eval $(call gb_Library_add_defs,sn_tools,\ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,sn_tools,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_Library_add_ldflags,sn_tools,\ + /DEF:$(SRCDIR)/setup_native/source/win32/customactions/tools/sn_tools.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,sn_tools,\ + setup_native/source/win32/customactions/tools/checkversion \ +)) + +$(eval $(call gb_Library_use_static_libraries,sn_tools,\ + seterror \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,sn_tools,\ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + kernel32 \ + msi \ + advapi32 \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Makefile b/setup_native/Makefile new file mode 100644 index 000000000..ccb1c85a0 --- /dev/null +++ b/setup_native/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Module_setup_native.mk b/setup_native/Module_setup_native.mk new file mode 100644 index 000000000..42fa14217 --- /dev/null +++ b/setup_native/Module_setup_native.mk @@ -0,0 +1,41 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,setup_native)) + +$(eval $(call gb_Module_add_targets,setup_native,\ + $(if $(filter MACOSX,$(OS)),CustomTarget_mac) \ + CustomTarget_spell \ + $(if $(filter WNT,$(OS)),Package_misc) \ + Package_packinfo \ + $(if $(filter LINUX SOLARIS,$(OS)), \ + CustomTarget_scripts \ + $(if $(ENABLE_ONLINE_UPDATE),Package_scripts) \ + ) \ +)) + +ifeq ($(OS),WNT) +$(eval $(call gb_Module_add_targets,setup_native,\ + Library_instooofiltmsi \ + Library_inst_msu_msi \ + Library_qslnkmsi \ + Library_reg_dlls \ + Library_reg4allmsdoc \ + Library_regactivex \ + Library_sdqsmsi \ + Library_sellangmsi \ + Library_shlxtmsi \ + Library_sn_tools \ + StaticLibrary_quickstarter \ + StaticLibrary_seterror \ +)) + +endif + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Package_misc.mk b/setup_native/Package_misc.mk new file mode 100644 index 000000000..a90a39945 --- /dev/null +++ b/setup_native/Package_misc.mk @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Package_Package,setup_native_misc,$(SRCDIR)/setup_native/source)) + +$(eval $(call gb_Package_add_file,setup_native_misc,$(LIBO_BIN_FOLDER)/desktophelper.txt,win32/desktophelper.txt)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Package_packinfo.mk b/setup_native/Package_packinfo.mk new file mode 100644 index 000000000..2519ead95 --- /dev/null +++ b/setup_native/Package_packinfo.mk @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Package_Package,setup_native_packinfo,$(SRCDIR)/setup_native/source/packinfo)) + +$(eval $(call gb_Package_add_file,setup_native_packinfo,$(LIBO_SHARE_FOLDER)/extensions/package.txt,package.txt)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/Package_scripts.mk b/setup_native/Package_scripts.mk new file mode 100644 index 000000000..2f8fb7944 --- /dev/null +++ b/setup_native/Package_scripts.mk @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Package_Package,setup_native_scripts,$(SRCDIR)/setup_native/scripts)) + +$(eval $(call gb_Package_add_file,setup_native_scripts,$(LIBO_BIN_FOLDER)/unpack_update,unpack_update.sh)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/StaticLibrary_quickstarter.mk b/setup_native/StaticLibrary_quickstarter.mk new file mode 100644 index 000000000..0517a7511 --- /dev/null +++ b/setup_native/StaticLibrary_quickstarter.mk @@ -0,0 +1,24 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,quickstarter)) + +$(eval $(call gb_StaticLibrary_add_defs,quickstarter,\ + -U_DLL \ +)) + +$(eval $(call gb_StaticLibrary_add_cxxflags,quickstarter,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_StaticLibrary_add_exception_objects,quickstarter,\ + setup_native/source/win32/customactions/quickstarter/quickstarter \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/StaticLibrary_seterror.mk b/setup_native/StaticLibrary_seterror.mk new file mode 100644 index 000000000..922976904 --- /dev/null +++ b/setup_native/StaticLibrary_seterror.mk @@ -0,0 +1,24 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,seterror)) + +$(eval $(call gb_StaticLibrary_add_defs,seterror,\ + -U_DLL \ +)) + +$(eval $(call gb_StaticLibrary_add_cxxflags,seterror,\ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ +)) + +$(eval $(call gb_StaticLibrary_add_exception_objects,seterror,\ + setup_native/source/win32/customactions/tools/seterror \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/setup_native/scripts/admin.pl b/setup_native/scripts/admin.pl new file mode 100644 index 000000000..714da400c --- /dev/null +++ b/setup_native/scripts/admin.pl @@ -0,0 +1,1244 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +use Cwd; +use File::Copy; +use File::Temp qw/ :mktemp /; + +################################################################################# +# Global settings +################################################################################# + +BEGIN +{ + $prog = "msi installer"; + $targetdir = ""; + $databasepath = ""; + $starttime = ""; + $globaltempdirname = "ooopackagingXXXXXX"; + $savetemppath = ""; + $msiinfo_available = 0; + $path_displayed = 0; + $localmsidbpath = ""; + + $plat = $^O; + + if ( $plat =~ /cygwin/i ) + { + $separator = "/"; + $pathseparator = "\:"; + } + else + { + $separator = "\\"; + $pathseparator = "\;"; + } +} + +################################################################################# +# Program information +################################################################################# + +sub usage +{ + print < 3 )) { usage(); } + + while ( $#ARGV >= 0 ) + { + my $param = shift(@ARGV); + + if ($param eq "-t") { $targetdir = shift(@ARGV); } + elsif ($param eq "-d") { $databasepath = shift(@ARGV); } + else + { + print "\n**********************************************\n"; + print "Error: Unknown parameter: $param"; + print "\n**********************************************\n"; + usage(); + exit(-1); + } + } +} + +################################################################################# +# Checking content of parameter +################################################################################# + +sub controlparameter +{ + if ( $targetdir eq "" ) + { + print "\n******************************************************\n"; + print "Error: Target directory not defined (parameter -t)!"; + print "\n******************************************************\n"; + usage(); + exit(-1); + } + + if ( $databasepath eq "" ) + { + print "\n******************************************************\n"; + print "Error: Path to msi database not defined (parameter -d)!"; + print "\n******************************************************\n"; + usage(); + exit(-1); + } + + if ( -d $databasepath ) + { + $databasepath =~ s/\\\s*$//; + $databasepath =~ s/\/\s*$//; + + my $msifiles = find_file_with_file_extension("msi", $databasepath); + + if ( $#{$msifiles} < 0 ) { exit_program("ERROR: Did not find msi database in directory $installationdir"); } + if ( $#{$msifiles} > 0 ) { exit_program("ERROR: Did find more than one msi database in directory $installationdir"); } + + $databasepath = $databasepath . $separator . ${$msifiles}[0]; + } + + if ( ! -f $databasepath ) { exit_program("ERROR: Did not find msi database in directory $databasepath."); } + + if ( ! -d $targetdir ) { create_directories($targetdir); } +} + +############################################################################# +# The program msidb.exe can be located next to the Perl program. Then it is +# not necessary to find it in the PATH variable. +############################################################################# + +sub check_local_msidb +{ + my $msidbname = "msidb.exe"; + my $perlprogramm = $0; + my $path = $perlprogramm; + + get_path_from_fullqualifiedname(\$path); + + $path =~ s/\\\s*$//; + $path =~ s/\/\s*$//; + + my $msidbpath = ""; + if ( $path =~ /^\s*$/ ) { $msidbpath = $msidbname; } + else { $msidbpath = $path . $separator . $msidbname; } + + if ( -f $msidbpath ) + { + $localmsidbpath = $msidbpath; + print "Using $msidbpath (next to \"admin.pl\")\n"; + } +} + +############################################################################# +# Converting a string list with separator $listseparator +# into an array +############################################################################# + +sub convert_stringlist_into_array +{ + my ( $includestringref, $listseparator ) = @_; + + my @newarray = (); + my $first; + my $last = ${$includestringref}; + + while ( $last =~ /^\s*(.+?)\Q$listseparator\E(.+)\s*$/) # "$" for minimal matching + { + $first = $1; + $last = $2; + # Problem with two directly following listseparators. For example a path with two ";;" directly behind each other + $first =~ s/^$listseparator//; + push(@newarray, "$first\n"); + } + + push(@newarray, "$last\n"); + + return \@newarray; +} + +######################################################### +# Checking the local system +# Checking existence of needed files in include path +######################################################### + +sub check_system_path +{ + my $onefile; + my $error = 0; + my $pathvariable = $ENV{'PATH'}; + my $local_pathseparator = $pathseparator; + + if( $^O =~ /cygwin/i ) + { # When using cygwin's perl the PATH variable is POSIX style and ... + $pathvariable = qx{cygpath -mp "$pathvariable"} ; + # has to be converted to DOS style for further use. + $local_pathseparator = ';'; + } + my $patharrayref = convert_stringlist_into_array(\$pathvariable, $local_pathseparator); + + my @needed_files_in_path = ("expand.exe"); + if ( $localmsidbpath eq "" ) { push(@needed_files_in_path, "msidb.exe"); } # not found locally -> search in path + my @optional_files_in_path = ("msiinfo.exe"); + + print("\nChecking required files:\n"); + + foreach $onefile ( @needed_files_in_path ) + { + print("... searching $onefile ..."); + + my $fileref = get_sourcepath_from_filename_and_includepath(\$onefile, $patharrayref); + + if ( $$fileref eq "" ) + { + $error = 1; + print( "$onefile not found\n" ); + } + else + { + print( "\tFound: $$fileref\n" ); + } + } + + if ( $error ) { exit_program("ERROR: Could not find all needed files in path (using setsolar should help)!"); } + + print("\nChecking optional files:\n"); + + foreach $onefile ( @optional_files_in_path ) + { + print("... searching $onefile ..."); + + my $fileref = get_sourcepath_from_filename_and_includepath(\$onefile, $patharrayref); + + if ( $$fileref eq "" ) + { + print( "$onefile not found\n" ); + if ( $onefile eq "msiinfo.exe" ) { $msiinfo_available = 0; } + } + else + { + print( "\tFound: $$fileref\n" ); + if ( $onefile eq "msiinfo.exe" ) { $msiinfo_available = 1; } + } + } + +} + +########################################################################## +# Searching a file in a list of paths +########################################################################## + +sub get_sourcepath_from_filename_and_includepath +{ + my ($searchfilenameref, $includepatharrayref) = @_; + + my $onefile = ""; + my $foundsourcefile = 0; + + for ( my $j = 0; $j <= $#{$includepatharrayref}; $j++ ) + { + my $includepath = ${$includepatharrayref}[$j]; + $includepath =~ s/^\s*//; + $includepath =~ s/\s*$//; + + $onefile = $includepath . $separator . $$searchfilenameref; + + if ( -f $onefile ) + { + $foundsourcefile = 1; + last; + } + } + + if (!($foundsourcefile)) { $onefile = ""; } + + return \$onefile; +} + +######################################################## +# Finding all files with a specified file extension +# in a specified directory. +######################################################## + +sub find_file_with_file_extension +{ + my ($extension, $dir) = @_; + + my @allfiles = (); + my @sourcefiles = (); + + $dir =~ s/\Q$separator\E\s*$//; + + opendir(DIR, $dir); + @sourcefiles = readdir(DIR); + closedir(DIR); + + my $onefile; + + foreach $onefile (@sourcefiles) + { + if ((!($onefile eq ".")) && (!($onefile eq ".."))) + { + if ( $onefile =~ /^\s*(\S.*?)\.$extension\s*$/ ) + { + push(@allfiles, $onefile) + } + } + } + + return \@allfiles; +} + +############################################################## +# Creating a directory with all parent directories +############################################################## + +sub create_directories +{ + my ($directory) = @_; + + if ( ! try_to_create_directory($directory) ) + { + my $parentdir = $directory; + get_path_from_fullqualifiedname(\$parentdir); + create_directories($parentdir); # recursive + } + + create_directory($directory); # now it has to succeed +} + +############################################################## +# Creating one directory +############################################################## + +sub create_directory +{ + my ($directory) = @_; + + if ( ! -d $directory ) { mkdir($directory, 0775); } +} + +############################################################## +# Trying to create a directory, no error if this fails +############################################################## + +sub try_to_create_directory +{ + my ($directory) = @_; + + my $returnvalue = 1; + my $created_directory = 0; + + if (!(-d $directory)) + { + $returnvalue = mkdir($directory, 0775); + + if ($returnvalue) + { + $created_directory = 1; + + my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1"; + system($localcall); + } + else + { + $created_directory = 0; + } + } + else + { + $created_directory = 1; + } + + return $created_directory; +} + +########################################### +# Getting path from full file name +########################################### + +sub get_path_from_fullqualifiedname +{ + my ($longfilenameref) = @_; + + if ( $$longfilenameref =~ /\Q$separator\E/ ) # Is there a separator in the path? Otherwise the path is empty. + { + if ( $$longfilenameref =~ /^\s*(\S.*\Q$separator\E)(\S.+\S?)/ ) + { + $$longfilenameref = $1; + } + } + else + { + $$longfilenameref = ""; # there is no path + } +} + +############################################################## +# Getting file name from full file name +############################################################## + +sub make_absolute_filename_to_relative_filename +{ + my ($longfilenameref) = @_; + + # Either '/' or '\'. + if ( $$longfilenameref =~ /^.*[\/\\](\S.+\S?)/ ) + { + $$longfilenameref = $1; + } +} + +############################################ +# Exiting the program with an error +# This function is used instead of "die" +############################################ + +sub exit_program +{ + my ($message) = @_; + + print "\n***************************************************************\n"; + print "$message\n"; + print "***************************************************************\n"; + remove_complete_directory($savetemppath, 1); + print "\n" . get_time_string(); + exit(-1); +} + +################################################################################# +# Unpacking cabinet files with expand +################################################################################# + +sub unpack_cabinet_file +{ + my ($cabfilename, $unpackdir) = @_; + + my $expandfile = "expand.exe"; # has to be in the PATH + + # expand.exe has to be located in the system directory. + # Cygwin has another tool expand.exe, that converts tabs to spaces. This cannot be used of course. + # But this wrong expand.exe is typically in the PATH before this expand.exe, to unpack + # cabinet files. + + if ( $^O =~ /cygwin/i ) + { + $expandfile = $ENV{'SYSTEMROOT'} . "/system32/expand.exe"; # Has to be located in the systemdirectory + $expandfile =~ s/\\/\//; + if ( ! -f $expandfile ) { exit_program("ERROR: Did not find file $expandfile in the Windows system folder!"); } + } + + my $expandlogfile = $unpackdir . $separator . "expand.log"; + + # exclude cabinet file + # my $systemcall = $cabarc . " -o X " . $mergemodulehash->{'cabinetfile'}; + + my $systemcall = ""; + if ( $^O =~ /cygwin/i ) { + my $localunpackdir = qx{cygpath -w "$unpackdir"}; + $localunpackdir =~ s/\\/\\\\/g; + + my $localcabfilename = qx{cygpath -w "$cabfilename"}; + $localcabfilename =~ s/\\/\\\\/g; + $localcabfilename =~ s/\s*$//g; + + $systemcall = $expandfile . " " . $localcabfilename . " -F:\* " . $localunpackdir . " \>\/dev\/null 2\>\&1"; + } + else + { + $systemcall = $expandfile . " " . $cabfilename . " -F:\* " . $unpackdir . " \> " . $expandlogfile; + } + + my $returnvalue = system($systemcall); + + if ($returnvalue) { exit_program("ERROR: Could not execute $systemcall !"); } +} + +################################################################################# +# Extracting tables from msi database +################################################################################# + +sub extract_tables_from_database +{ + my ($fullmsidatabasepath, $workdir, $tablelist) = @_; + + my $msidb = "msidb.exe"; # Has to be in the path + if ( $localmsidbpath ) { $msidb = $localmsidbpath; } + my $infoline = ""; + my $systemcall = ""; + my $returnvalue = ""; + + if ( $^O =~ /cygwin/i ) { + chomp( $fullmsidatabasepath = qx{cygpath -w "$fullmsidatabasepath"} ); + # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) + $fullmsidatabasepath =~ s/\\/\\\\/g; + $workdir =~ s/\\/\\\\/g; + # and if there are still slashes, they also need to be double backslash + $fullmsidatabasepath =~ s/\//\\\\/g; + $workdir =~ s/\//\\\\/g; + } + + # Export of all tables by using "*" + + $systemcall = $msidb . " -d " . $fullmsidatabasepath . " -f " . $workdir . " -e $tablelist"; + print "\nAnalyzing msi database\n"; + $returnvalue = system($systemcall); + + if ($returnvalue) + { + $infoline = "ERROR: Could not execute $systemcall !\n"; + exit_program($infoline); + } +} + +######################################################## +# Check, if this installation set contains +# internal cabinet files included into the msi +# database. +######################################################## + +sub check_for_internal_cabfiles +{ + my ($cabfilehash) = @_; + + my $contains_internal_cabfiles = 0; + my %allcabfileshash = (); + + foreach my $filename ( keys %{$cabfilehash} ) + { + if ( $filename =~ /^\s*\#/ ) # starting with a hash + { + $contains_internal_cabfiles = 1; + # setting real filename without hash as key and name with hash as value + my $realfilename = $filename; + $realfilename =~ s/^\s*\#//; + $allcabfileshash{$realfilename} = $filename; + } + } + + return ( $contains_internal_cabfiles, \%allcabfileshash ); +} + +################################################################# +# Exclude all cab files from the msi database. +################################################################# + +sub extract_cabs_from_database +{ + my ($msidatabase, $allcabfiles) = @_; + + my $infoline = ""; + my $fullsuccess = 1; + my $msidb = "msidb.exe"; # Has to be in the path + if ( $localmsidbpath ) { $msidb = $localmsidbpath; } + + my @all_excluded_cabfiles = (); + + if( $^O =~ /cygwin/i ) + { + $msidatabase = qx{cygpath -w "$msidatabase"}; + $msidatabase =~ s/\\/\\\\/g; + $msidatabase =~ s/\s*$//g; + } + else + { + # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) + $msidatabase =~ s/\//\\\\/g; + } + + foreach my $onefile ( keys %{$allcabfiles} ) + { + my $systemcall = $msidb . " -d " . $msidatabase . " -x " . $onefile; + system($systemcall); + push(@all_excluded_cabfiles, $onefile); + } + + \@all_excluded_cabfiles; +} + +################################################################################ +# Collect all DiskIds to the corresponding cabinet files from Media.idt. +################################################################################ + +sub analyze_media_file +{ + my ($filecontent) = @_; + + my %diskidhash = (); + + for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) + { + if ( $i < 3 ) { next; } + + if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) + { + my $diskid = $1; + my $cabfile = $4; + + $diskidhash{$cabfile} = $diskid; + } + } + + return \%diskidhash; +} + +################################################################################ +# Analyzing the content of Directory.idt +################################################################################# + +sub analyze_directory_file +{ + my ($filecontent) = @_; + + my %table = (); + + for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) + { + if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; } + + if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\s*$/ ) + { + my $dir = $1; + my $parent = $2; + my $name = $3; + + if ( $name =~ /^\s*(.*?)\s*\:\s*(.*?)\s*$/ ) { $name = $2; } + if ( $name =~ /^\s*(.*?)\s*\|\s*(.*?)\s*$/ ) { $name = $2; } + + my %helphash = (); + $helphash{'Directory_Parent'} = $parent; + $helphash{'DefaultDir'} = $name; + $table{$dir} = \%helphash; + } + } + + return \%table; +} + +################################################################################# +# Analyzing the content of Component.idt +################################################################################# + +sub analyze_component_file +{ + my ($filecontent) = @_; + + my %table = (); + + for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) + { + if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; } + + if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) + { + my $component = $1; + my $dir = $3; + + $table{$component} = $dir; + } + } + + return \%table; +} + +################################################################################# +# Analyzing the content of File.idt +################################################################################# + +sub analyze_file_file +{ + my ($filecontent) = @_; + + my %table = (); + my %fileorder = (); + my $maxsequence = 0; + + for ( my $i = 0; $i <= $#{$filecontent}; $i++ ) + { + if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; } + + if ( ${$filecontent}[$i] =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\s*$/ ) + { + my $file = $1; + my $comp = $2; + my $filename = $3; + my $sequence = $8; + + if ( $filename =~ /^\s*(.*?)\s*\|\s*(.*?)\s*$/ ) { $filename = $2; } + + my %helphash = (); + $helphash{'Component'} = $comp; + $helphash{'FileName'} = $filename; + $helphash{'Sequence'} = $sequence; + + $table{$file} = \%helphash; + + $fileorder{$sequence} = $file; + + if ( $sequence > $maxsequence ) { $maxsequence = $sequence; } + } + } + + return (\%table, \%fileorder, $maxsequence); +} + +#################################################################################### +# Recursively creating the directory tree +#################################################################################### + +sub create_directory_tree +{ + my ($parent, $pathcollector, $fulldir, $dirhash) = @_; + + foreach my $dir ( keys %{$dirhash} ) + { + if (( $dirhash->{$dir}->{'Directory_Parent'} eq $parent ) && ( $dirhash->{$dir}->{'DefaultDir'} ne "." )) + { + my $dirname = $dirhash->{$dir}->{'DefaultDir'}; + # Create the directory + my $newdir = $fulldir . $separator . $dirname; + if ( ! -f $newdir ) { mkdir $newdir; } + # Saving in collector + $pathcollector->{$dir} = $newdir; + # Iteration + create_directory_tree($dir, $pathcollector, $newdir, $dirhash); + } + } +} + +#################################################################################### +# Creating the directory tree +#################################################################################### + +sub create_directory_structure +{ + my ($dirhash, $targetdir) = @_; + + print "Creating directories\n"; + + my %fullpathhash = (); + + my @startparents = ("TARGETDIR", "INSTALLLOCATION"); + + foreach $dir (@startparents) { create_directory_tree($dir, \%fullpathhash, $targetdir, $dirhash); } + + # Also adding the paths of the startparents + foreach $dir (@startparents) + { + if ( ! exists($fullpathhash{$dir}) ) { $fullpathhash{$dir} = $targetdir; } + } + + return \%fullpathhash; +} + +#################################################################################### +# Cygwin: Setting privileges for files +#################################################################################### + +sub change_privileges +{ + my ($destfile, $privileges) = @_; + + my $localcall = "chmod $privileges " . "\"" . $destfile . "\""; + system($localcall); +} + +#################################################################################### +# Cygwin: Setting privileges for files recursively +#################################################################################### + +sub change_privileges_full +{ + my ($target) = @_; + + print "Changing privileges\n"; + + my $localcall = "chmod -R 755 " . "\"" . $target . "\""; + system($localcall); +} + +###################################################### +# Creating a new directory with defined privileges +###################################################### + +sub create_directory_with_privileges +{ + my ($directory, $privileges) = @_; + + my $returnvalue = 1; + my $infoline = ""; + + if (!(-d $directory)) + { + my $localprivileges = oct("0".$privileges); # changes "777" to 0777 + $returnvalue = mkdir($directory, $localprivileges); + + if ($returnvalue) + { + my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; + system($localcall); + } + } + else + { + my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1"; + system($localcall); + } +} + +###################################################### +# Creating a unique directory with pid extension +###################################################### + +sub create_pid_directory +{ + my ($directory) = @_; + + $directory =~ s/\Q$separator\E\s*$//; + my $pid = $$; # process id + my $time = time(); # time + + $directory = $directory . "_" . $pid . $time; + + if ( ! -d $directory ) { create_directory($directory); } + else { exit_program("ERROR: Directory $directory already exists!"); } + + return $directory; +} + +#################################################################################### +# Copying files into installation set +#################################################################################### + +sub copy_files_into_directory_structure +{ + my ($fileorder, $filehash, $componenthash, $fullpathhash, $maxsequence, $unpackdir, $installdir, $dirhash) = @_; + + print "Copying files\n"; + + for ( my $i = 1; $i <= $maxsequence; $i++ ) + { + if ( exists($fileorder->{$i}) ) + { + my $file = $fileorder->{$i}; + if ( ! exists($filehash->{$file}->{'Component'}) ) { exit_program("ERROR: Did not find component for file: \"$file\"."); } + my $component = $filehash->{$file}->{'Component'}; + if ( ! exists($componenthash->{$component}) ) { exit_program("ERROR: Did not find directory for component: \"$component\"."); } + my $dirname = $componenthash->{$component}; + if ( ! exists($fullpathhash->{$dirname}) ) { exit_program("ERROR: Did not find full directory path for dir: \"$dirname\"."); } + my $destdir = $fullpathhash->{$dirname}; + if ( ! exists($filehash->{$file}->{'FileName'}) ) { exit_program("ERROR: Did not find \"FileName\" for file: \"$file\"."); } + my $destfile = $filehash->{$file}->{'FileName'}; + + $destfile = $destdir . $separator . $destfile; + my $sourcefile = $unpackdir . $separator . $file; + + if ( ! -f $sourcefile ) + { + # It is possible, that this was an unpacked file + # Looking in the dirhash, to find the subdirectory in the installation set (the id is $dirname) + # subdir is not recursively analyzed, only one directory. + + my $oldsourcefile = $sourcefile; + my $subdir = ""; + if ( exists($dirhash->{$dirname}->{'DefaultDir'}) ) { $subdir = $dirhash->{$dirname}->{'DefaultDir'} . $separator; } + my $realfilename = $filehash->{$file}->{'FileName'}; + my $localinstalldir = $installdir; + + $localinstalldir =~ s/\\\s*$//; + $localinstalldir =~ s/\/\s*$//; + + $sourcefile = $localinstalldir . $separator . $subdir . $realfilename; + + if ( ! -f $sourcefile ) { exit_program("ERROR: File not found: \"$oldsourcefile\" (or \"$sourcefile\")."); } + } + + my $copyreturn = copy($sourcefile, $destfile); + + if ( ! $copyreturn) { exit_program("ERROR: Could not copy $source to $dest\n"); } + + # if (( $^O =~ /cygwin/i ) && ( $destfile =~ /\.exe\s*$/ )) { change_privileges($destfile, "775"); } + } + # else # allowing missing sequence numbers ? + # { + # exit_program("ERROR: No file assigned to sequence $i"); + # } + } +} + +###################################################### +# Removing a complete directory with subdirectories +###################################################### + +sub remove_complete_directory +{ + my ($directory, $start) = @_; + + my @content = (); + my $infoline = ""; + + $directory =~ s/\Q$separator\E\s*$//; + + if ( -d $directory ) + { + if ( $start ) { print "Removing directory $directory\n"; } + + opendir(DIR, $directory); + @content = readdir(DIR); + closedir(DIR); + + my $oneitem; + + foreach $oneitem (@content) + { + if ((!($oneitem eq ".")) && (!($oneitem eq ".."))) + { + my $item = $directory . $separator . $oneitem; + + if ( -f $item || -l $item ) # deleting files or links + { + unlink($item); + } + + if ( -d $item ) # recursive + { + remove_complete_directory($item, 0); + } + } + } + + # try to remove empty directory + my $returnvalue = rmdir $directory; + if ( ! $returnvalue ) { print "Warning: Problem with removing empty dir $directory\n"; } + } +} + +#################################################################################### +# Defining a temporary path +#################################################################################### + +sub get_temppath +{ + my $temppath = ""; + + if (( $ENV{'TMP'} ) || ( $ENV{'TEMP'} )) + { + if ( $ENV{'TMP'} ) { $temppath = $ENV{'TMP'}; } + elsif ( $ENV{'TEMP'} ) { $temppath = $ENV{'TEMP'}; } + + $temppath =~ s/\Q$separator\E\s*$//; # removing ending slashes and backslashes + $temppath = $temppath . $separator . $globaltempdirname; + $temppath = mkdtemp($temppath); + + my $dirsave = $temppath; + + $temppath = $temppath . $separator . "a"; + $temppath = create_pid_directory($temppath); + + if ( ! -d $temppath ) { exit_program("ERROR: Failed to create directory $temppath ! Possible reason: Wrong privileges in directory $dirsave."); } + + if ( $^O =~ /cygwin/i ) + { + $temppath =~ s/\\/\\\\/g; + chomp( $temppath = qx{cygpath -w "$temppath"} ); + } + + $savetemppath = $temppath; + } + else + { + exit_program("ERROR: Could not set temporary directory (TMP and TEMP not set!)."); + } + + return $temppath; +} + +#################################################################################### +# Reading one file +#################################################################################### + +sub read_file +{ + my ($localfile) = @_; + + my @localfile = (); + + open( IN, "<$localfile" ) || exit_program("ERROR: Cannot open file $localfile for reading"); + + # Don't use "my @localfile = " here, because + # perl has a problem with the internal "large_and_huge_malloc" function + # when calling perl using MacOS 10.5 with a perl built with MacOS 10.4 + while ( $line = ) { + push @localfile, $line; + } + + close( IN ); + + return \@localfile; +} + +############################################################### +# Setting the time string for the +# Summary Information stream in the +# msi database of the admin installations. +############################################################### + +sub get_sis_time_string +{ + # Syntax: + my $second = (localtime())[0]; + my $minute = (localtime())[1]; + my $hour = (localtime())[2]; + my $day = (localtime())[3]; + my $month = (localtime())[4]; + my $year = 1900 + (localtime())[5]; + $month++; + + if ( $second < 10 ) { $second = "0" . $second; } + if ( $minute < 10 ) { $minute = "0" . $minute; } + if ( $hour < 10 ) { $hour = "0" . $hour; } + if ( $day < 10 ) { $day = "0" . $day; } + if ( $month < 10 ) { $month = "0" . $month; } + + my $timestring = $year . "/" . $month . "/" . $day . " " . $hour . ":" . $minute . ":" . $second; + + return $timestring; +} + +############################################################### +# Writing content of administrative installations into +# Summary Information Stream of msi database. +# This is required for example for following +# patch processes using Windows Installer service. +############################################################### + +sub write_sis_info +{ + my ($msidatabase) = @_; + + print "Setting SIS in msi database\n"; + + if ( ! -f $msidatabase ) { exit_program("ERROR: Cannot find file $msidatabase"); } + + my $msiinfo = "msiinfo.exe"; # Has to be in the path + my $infoline = ""; + my $systemcall = ""; + my $returnvalue = ""; + + # Required setting for administrative installations: + # -w 4 (source files are unpacked), wordcount + # -s , LastPrinted, Syntax: + # -l , LastSavedBy + + my $wordcount = 4; # Unpacked files + my $lastprinted = get_sis_time_string(); + my $lastsavedby = "Installer"; + + my $localmsidatabase = $msidatabase; + + if( $^O =~ /cygwin/i ) + { + $localmsidatabase = qx{cygpath -w "$localmsidatabase"}; + $localmsidatabase =~ s/\\/\\\\/g; + $localmsidatabase =~ s/\s*$//g; + } + + $systemcall = $msiinfo . " " . "\"" . $localmsidatabase . "\"" . " -w " . $wordcount . " -s " . "\"" . $lastprinted . "\"" . " -l $lastsavedby"; + + $returnvalue = system($systemcall); + + if ($returnvalue) + { + $infoline = "ERROR: Could not execute $systemcall !\n"; + exit_program($infoline); + } +} + +############################################################### +# Convert time string +############################################################### + +sub convert_timestring +{ + my ($secondstring) = @_; + + my $timestring = ""; + + if ( $secondstring < 60 ) # less than a minute + { + if ( $secondstring < 10 ) { $secondstring = "0" . $secondstring; } + $timestring = "00\:$secondstring min\."; + } + elsif ( $secondstring < 3600 ) + { + my $minutes = $secondstring / 60; + my $seconds = $secondstring % 60; + if ( $minutes =~ /(\d*)\.\d*/ ) { $minutes = $1; } + if ( $minutes < 10 ) { $minutes = "0" . $minutes; } + if ( $seconds < 10 ) { $seconds = "0" . $seconds; } + $timestring = "$minutes\:$seconds min\."; + } + else # more than one hour + { + my $hours = $secondstring / 3600; + my $secondstring = $secondstring % 3600; + my $minutes = $secondstring / 60; + my $seconds = $secondstring % 60; + if ( $hours =~ /(\d*)\.\d*/ ) { $hours = $1; } + if ( $minutes =~ /(\d*)\.\d*/ ) { $minutes = $1; } + if ( $hours < 10 ) { $hours = "0" . $hours; } + if ( $minutes < 10 ) { $minutes = "0" . $minutes; } + if ( $seconds < 10 ) { $seconds = "0" . $seconds; } + $timestring = "$hours\:$minutes\:$seconds hours"; + } + + return $timestring; +} + +############################################################### +# Returning time string for logging +############################################################### + +sub get_time_string +{ + my $currenttime = time(); + $currenttime = $currenttime - $starttime; + $currenttime = convert_timestring($currenttime); + $currenttime = localtime() . " \(" . $currenttime . "\)\n"; + return $currenttime; +} + +#################################################################################### +# Simulating an administrative installation +#################################################################################### + +$starttime = time(); + +getparameter(); +controlparameter(); +check_local_msidb(); +check_system_path(); +my $temppath = get_temppath(); + +print("\nmsi database: $databasepath\n"); +print("Destination directory: $targetdir\n" ); + +my $helperdir = $temppath . $separator . "installhelper"; +create_directory($helperdir); + +# Get File.idt, Component.idt and Directory.idt from database + +my $tablelist = "File Directory Component Media CustomAction"; +extract_tables_from_database($databasepath, $helperdir, $tablelist); + +# Set unpackdir +my $unpackdir = $helperdir . $separator . "unpack"; +create_directory($unpackdir); + +# Reading media table to check for internal cabinet files +my $filename = $helperdir . $separator . "Media.idt"; +if ( ! -f $filename ) { exit_program("ERROR: Could not find required file: $filename !"); } +my $filecontent = read_file($filename); +my $cabfilehash = analyze_media_file($filecontent); + +# Check, if there are internal cab files +my ( $contains_internal_cabfiles, $all_internal_cab_files) = check_for_internal_cabfiles($cabfilehash); + +if ( $contains_internal_cabfiles ) +{ + # Set unpackdir + my $cabdir = $helperdir . $separator . "internal_cabs"; + create_directory($cabdir); + my $from = cwd(); + chdir($cabdir); + # Exclude all cabinet files from database + my $all_excluded_cabs = extract_cabs_from_database($databasepath, $all_internal_cab_files); + print "Unpacking files from internal cabinet file(s)\n"; + foreach my $cabfile ( @{$all_excluded_cabs} ) { unpack_cabinet_file($cabfile, $unpackdir); } + chdir($from); +} + +# Unpack all cab files into $helperdir, cab files must be located next to msi database +my $installdir = $databasepath; + +get_path_from_fullqualifiedname(\$installdir); + +my $databasefilename = $databasepath; +make_absolute_filename_to_relative_filename(\$databasefilename); + +my $cabfiles = find_file_with_file_extension("cab", $installdir); + +if (( $#{$cabfiles} < 0 ) && ( ! $contains_internal_cabfiles )) { exit_program("ERROR: Did not find any cab file in directory $installdir"); } + +print "Unpacking files from cabinet file(s)\n"; +for ( my $i = 0; $i <= $#{$cabfiles}; $i++ ) +{ + my $cabfile = $installdir . $separator . ${$cabfiles}[$i]; + unpack_cabinet_file($cabfile, $unpackdir); +} + +# Reading tables +$filename = $helperdir . $separator . "Directory.idt"; +$filecontent = read_file($filename); +my $dirhash = analyze_directory_file($filecontent); + +$filename = $helperdir . $separator . "Component.idt"; +$filecontent = read_file($filename); +my $componenthash = analyze_component_file($filecontent); + +$filename = $helperdir . $separator . "File.idt"; +$filecontent = read_file($filename); +my ( $filehash, $fileorder, $maxsequence ) = analyze_file_file($filecontent); + +# Creating the directory structure +my $fullpathhash = create_directory_structure($dirhash, $targetdir); + +# Copying files +copy_files_into_directory_structure($fileorder, $filehash, $componenthash, $fullpathhash, $maxsequence, $unpackdir, $installdir, $dirhash); +if ( $^O =~ /cygwin/i ) { change_privileges_full($targetdir); } + +my $msidatabase = $targetdir . $separator . $databasefilename; +my $copyreturn = copy($databasepath, $msidatabase); +if ( ! $copyreturn) { exit_program("ERROR: Could not copy $source to $dest\n"); } + +# Saving info in Summary Information Stream of msi database (required for following patches) +if ( $msiinfo_available ) { write_sis_info($msidatabase); } + +# Removing the helper directory +remove_complete_directory($temppath, 1); + +print "\nSuccessful installation: " . get_time_string(); diff --git a/setup_native/scripts/downloadscript.sh b/setup_native/scripts/downloadscript.sh new file mode 100644 index 000000000..7246ebcda --- /dev/null +++ b/setup_native/scripts/downloadscript.sh @@ -0,0 +1,104 @@ +#!/bin/sh +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +linenum=LINENUMBERPLACEHOLDER + +UNPACKDIR=/var/tmp/unpack_PRODUCTNAMEPLACEHOLDER +diskSpaceRequired=DISCSPACEPLACEHOLDER +checksum=CHECKSUMPLACEHOLDER + +EXTRACTONLY="no" +if [ "$1" = "-x" ] +then + EXTRACTONLY=yes +fi + +# Determining current platform + +platform=`uname -s` + +case $platform in +SunOS) + tail_prog="tail" + ;; +Linux) + tail_prog="tail -n" + ;; +*) + tail_prog="tail" + ;; +esac + +# Asking for the unpack directory + +echo +echo "Select the directory in which to save the unpacked files. [$UNPACKDIR] " +read reply leftover +if [ "x$reply" != "x" ] +then + UNPACKDIR="$reply" +fi + +if [ -d $UNPACKDIR ]; then + printf "Directory $UNPACKDIR already exists.\n" + printf "Please select a new directory name.\n" + exit 1 +fi + +# Unpacking + +mkdir -m 700 $UNPACKDIR + +diskSpace=`df -k $UNPACKDIR | $tail_prog -1 | awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'` +if [ $diskSpace -lt $diskSpaceRequired ]; then + printf "The selected drive does not have enough disk space available.\n" + printf "PRODUCTNAMEPLACEHOLDER requires at least %s kByte.\n" $diskSpaceRequired + exit 1 +fi + +trap 'rm -rf $UNPACKDIR; exit 1' HUP INT QUIT TERM + +if [ -x /usr/bin/sum ] ; then + echo "File is being checked for errors ..." + + sum=`$tail_prog +$linenum $0 | /usr/bin/sum` + sum=`echo $sum | awk '{ print $1 }'` + + if [ $sum != $checksum ]; then + echo "The download file appears to be corrupted. Please download PRODUCTNAMEPLACEHOLDER again." + exit 1 + fi +fi + +echo "Unpacking ..." + +$tail_prog +$linenum $0 | (cd $UNPACKDIR; tar xf -) + +echo "All files have been successfully unpacked." + +if [ "$EXTRACTONLY" != "yes" ] +then + if [ -f $UNPACKDIR/setup ] + then + chmod 775 $UNPACKDIR/setup + $UNPACKDIR/setup + fi +fi + +exit 0 diff --git a/setup_native/scripts/fake-db.spec b/setup_native/scripts/fake-db.spec new file mode 100644 index 000000000..a7a5c318b --- /dev/null +++ b/setup_native/scripts/fake-db.spec @@ -0,0 +1,57 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +Name: fake-db +Version: 1.0 +Release: 0 +Summary: This is a dummy package +Group: dummy +License: LGPLv3 with MPLv2 on ALv2 +BuildArch: noarch +AutoReqProv: no +%define _tmppath /tmp +#BuildRoot: %{_tmppath}/%{name}-root +Provides: libgnomevfs-2.so.0 +Provides: libgnomevfs-2.so.0()(64bit) +Provides: libfreetype.so.6 +Provides: libfreetype.so.6()(64bit) +Provides: /bin/sh +Provides: /bin/basename +Provides: /bin/cat +Provides: /bin/cp +Provides: /bin/gawk +Provides: /bin/grep +Provides: /bin/ln +Provides: /bin/ls +Provides: /bin/mkdir +Provides: /bin/mv +Provides: /bin/pwd +Provides: /bin/rm +Provides: /bin/sed +Provides: /bin/sort +Provides: /bin/touch +Provides: /usr/bin/cut +Provides: /usr/bin/dirname +Provides: /usr/bin/expr +Provides: /usr/bin/find +Provides: /usr/bin/tail +Provides: /usr/bin/tr +Provides: /usr/bin/wc +%description +a dummy package +%files diff --git a/setup_native/scripts/install_create.pl b/setup_native/scripts/install_create.pl new file mode 100644 index 000000000..c7659c40e --- /dev/null +++ b/setup_native/scripts/install_create.pl @@ -0,0 +1,60 @@ +: # -*- perl -*- +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +# create setup self extracting script + +if( $#ARGV < 2 ) + { + print < + : the start shell script, located next to this perl script + : the library file, that is included into the shell script + : the target shellscript + +ENDHELP + exit; + } + +$infile = $ARGV[0]; +$library = $ARGV[1]; +$outfile = $ARGV[2]; + +# read script header +open( SCRIPT, "<$infile" ) || die "cannot open $infile"; +open( OUTFILE, ">$outfile$$.tmp" ) || die "cannot open $outfile"; +@scriptlines =