Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
6c7dc579
Commit
6c7dc579
authored
Jun 12, 2013
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement apt-get dist-upgrade
parent
690e72cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
2 deletions
+48
-2
APT.pm
PVE/API2/APT.pm
+48
-2
No files found.
PVE/API2/APT.pm
View file @
6c7dc579
...
@@ -150,7 +150,7 @@ __PACKAGE__->register_method({
...
@@ -150,7 +150,7 @@ __PACKAGE__->register_method({
my
$st2
=
File::stat::
stat
("
/var/cache/apt/pkgcache.bin
");
my
$st2
=
File::stat::
stat
("
/var/cache/apt/pkgcache.bin
");
my
$st3
=
File::stat::
stat
("
/var/lib/dpkg/status
");
my
$st3
=
File::stat::
stat
("
/var/lib/dpkg/status
");
if
(
$st2
->
mtime
<
$st1
->
mtime
&&
$st3
->
mtime
<
$st1
->
mtime
)
{
if
(
$st2
->
mtime
<
=
$st1
->
mtime
&&
$st3
->
mtime
<=
$st1
->
mtime
)
{
my
$data
;
my
$data
;
eval
{
eval
{
my
$jsonstr
=
PVE::Tools::
file_get_contents
(
$pve_pkgstatus_fn
,
5
*
1024
*
1024
);
my
$jsonstr
=
PVE::Tools::
file_get_contents
(
$pve_pkgstatus_fn
,
5
*
1024
*
1024
);
...
@@ -210,7 +210,53 @@ __PACKAGE__->register_method({
...
@@ -210,7 +210,53 @@ __PACKAGE__->register_method({
return
;
return
;
};
};
return
$rpcenv
->
fork_worker
('
apt
',
undef
,
$authuser
,
$realcmd
);
return
$rpcenv
->
fork_worker
('
aptupdate
',
undef
,
$authuser
,
$realcmd
);
}});
__PACKAGE__
->
register_method
({
name
=>
'
upgrade
',
path
=>
'
upgrade
',
method
=>
'
POST
',
description
=>
"
Install the newest versions of all packages (apt-get dist-upgrade).
",
permissions
=>
{
check
=>
['
perm
',
'
/nodes/{node}
',
[
'
Sys.Modify
'
]],
},
protected
=>
1
,
proxyto
=>
'
node
',
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
{
node
=>
get_standard_option
('
pve-node
'),
},
},
returns
=>
{
type
=>
'
string
',
},
code
=>
sub
{
my
(
$param
)
=
@_
;
my
$rpcenv
=
PVE::RPCEnvironment::
get
();
my
$authuser
=
$rpcenv
->
get_user
();
my
$realcmd
=
sub
{
my
$upid
=
shift
;
my
$cmd
=
['
apt-get
',
'
dist-upgrade
',
'
--assume-yes
'];
print
"
starting apt-get dist-upgrade
\n
";
$ENV
{
DEBIAN_FRONTEND
}
=
'
noninteractive
';
PVE::Tools::
run_command
(
$cmd
);
&
$update_pve_pkgstatus
();
return
;
};
return
$rpcenv
->
fork_worker
('
aptupgrade
',
undef
,
$authuser
,
$realcmd
);
}});
}});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment