Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
41ec2e01
Commit
41ec2e01
authored
14 years ago
by
Andrew A. de Laix
Browse files
Options
Downloads
Patches
Plain Diff
copy script to temp if needed before installing.
parent
9d33a548
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/viewer_components/updater/llupdateinstaller.cpp
+41
-3
41 additions, 3 deletions
indra/viewer_components/updater/llupdateinstaller.cpp
indra/viewer_components/updater/llupdateinstaller.h
+9
-1
9 additions, 1 deletion
indra/viewer_components/updater/llupdateinstaller.h
with
50 additions
and
4 deletions
indra/viewer_components/updater/llupdateinstaller.cpp
+
41
−
3
View file @
41ec2e01
...
@@ -24,15 +24,53 @@
...
@@ -24,15 +24,53 @@
*/
*/
#include
"linden_common.h"
#include
"linden_common.h"
#include
<apr_file_io.h>
#include
"llapr.h"
#include
"llprocesslauncher.h"
#include
"llprocesslauncher.h"
#include
"llupdateinstaller.h"
#include
"llupdateinstaller.h"
#include
"lldir.h"
void
ll_install_update
(
std
::
string
const
&
script
,
std
::
string
const
&
updatePath
)
namespace
{
class
RelocateError
{};
std
::
string
copy_to_temp
(
std
::
string
const
&
path
)
{
std
::
string
scriptFile
=
gDirUtilp
->
getBaseFileName
(
path
);
std
::
string
newPath
=
gDirUtilp
->
getExpandedFilename
(
LL_PATH_TEMP
,
scriptFile
);
apr_status_t
status
=
apr_file_copy
(
path
.
c_str
(),
newPath
.
c_str
(),
APR_FILE_SOURCE_PERMS
,
gAPRPoolp
);
if
(
status
!=
APR_SUCCESS
)
throw
RelocateError
();
return
newPath
;
}
}
int
ll_install_update
(
std
::
string
const
&
script
,
std
::
string
const
&
updatePath
,
LLInstallScriptMode
mode
)
{
{
std
::
string
finalPath
;
switch
(
mode
)
{
case
LL_COPY_INSTALL_SCRIPT_TO_TEMP
:
try
{
finalPath
=
copy_to_temp
(
updatePath
);
}
catch
(
RelocateError
&
)
{
return
-
1
;
}
break
;
case
LL_RUN_INSTALL_SCRIPT_IN_PLACE
:
finalPath
=
updatePath
;
break
;
default
:
llassert
(
!
"unpossible copy mode"
);
}
LLProcessLauncher
launcher
;
LLProcessLauncher
launcher
;
launcher
.
setExecutable
(
script
);
launcher
.
setExecutable
(
script
);
launcher
.
addArgument
(
update
Path
);
launcher
.
addArgument
(
final
Path
);
launcher
.
launch
();
int
result
=
launcher
.
launch
();
launcher
.
orphan
();
launcher
.
orphan
();
return
result
;
}
}
This diff is collapsed.
Click to expand it.
indra/viewer_components/updater/llupdateinstaller.h
+
9
−
1
View file @
41ec2e01
...
@@ -30,13 +30,21 @@
...
@@ -30,13 +30,21 @@
#include
<string>
#include
<string>
enum
LLInstallScriptMode
{
LL_RUN_INSTALL_SCRIPT_IN_PLACE
,
LL_COPY_INSTALL_SCRIPT_TO_TEMP
};
//
//
// Launch the installation script.
// Launch the installation script.
//
//
// The updater will overwrite the current installation, so it is highly recommended
// The updater will overwrite the current installation, so it is highly recommended
// that the current application terminate once this function is called.
// that the current application terminate once this function is called.
//
//
void
ll_install_update
(
std
::
string
const
&
script
,
std
::
string
const
&
updatePath
);
int
ll_install_update
(
std
::
string
const
&
script
,
// Script to execute.
std
::
string
const
&
updatePath
,
// Path to update file.
LLInstallScriptMode
mode
=
LL_COPY_INSTALL_SCRIPT_TO_TEMP
);
// Run in place or copy to temp?
#endif
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment