Set a brief description of the package components
xpack_component("LongPath")
set_title("Enable Long Path")
Set detailed description of package components
xpack_component("LongPath")
set_description("Increases the maximum path length limit, up to 32,767 characters (before 256).")
Usually the package component is enabled by default, but we can also use this interface to disable this component by default. Only when the user chooses to check this component when installing the package will it be enabled for installation.
xpack_component("LongPath")
set_default(false)
set_title("Enable Long Path")
We can further flexibly configure package components in the on_load custom script field.
xpack_component("test")
on_load(function (component)
local package = component:package()
-- TODO
end)
It will not rewrite the entire installation script, but will add some custom installation scripts before the existing installation scripts are executed:
xpack_component("test")
before_installcmd(function (component, batchcmds)
batchcmds:mkdir(package:installdir("resources"))
batchcmds:cp("src/assets/*.txt", package:installdir("resources"), {rootdir = "src"})
batchcmds:mkdir(package:installdir("stub"))
end)
It should be noted that the cp, mkdir and other commands added through batchcmds will not be executed immediately, but will only generate a command list. When the package is actually generated later, these commands will be translated into packaging commands.
It is exactly the same as xpack's before_installcmd. The only difference is that the installation script here will only be executed when this component is enabled.
This will rewrite the entire component's installation script, similar to xpack's on_installcmd.
xpack_component("test")
on_installcmd(function (component, batchcmds)
-- TODO
end)
After the component is installed, the script here will be executed, similar to xpack's after_installcmd.
xpack_component("test")
after_installcmd(function (component, batchcmds)
-- TODO
end)
After the component is installed, the script here will be executed, similar to xpack's before_uninstallcmd.
xpack_component("test")
before_uninstallcmd(function (component, batchcmds)
-- TODO
end)
This will rewrite the entire component's uninstall script, similar to xpack's on_uninstallcmd.
xpack_component("test")
on_uninstallcmd(function (component, batchcmds)
-- TODO
end)
After the component is uninstalled, the script here will be executed, similar to xpack's before_uninstallcmd.
xpack_component("test")
before_uninstallcmd(function (component, batchcmds)
-- TODO
end)
This is similar to xpack's add_sourcefiles, but here only when the component is enabled, these source files will be added to the installation package.
This is similar to xpack's add_installfiles, but here only the binaries are added to the installation package when the component is enabled.