Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathapt.js
More file actions
Latest commit
64 lines (53 loc) · 1.69 KB
/
Copy pathapt.js
File metadata and controls
64 lines (53 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
'use strict';
constcore=require('@actions/core')
const{ execSync, grpSt, grpEnd, getInput }=require('./common')
// group start time
letmsSt
exportconstrun=async()=>{
try{
// clean input
letapt=getInput('apt-get')
if(apt!==''){
// fix for server timeout issues
/* msSt = grpSt('apt-get server fix')
* apt += ' _update_'
* execSync(`sudo sed -i 's/azure\\.//' /etc/apt/sources.list`)
* grpEnd(msSt)
*/
constopts='-o Acquire::Retries=3'
letneedUpdate=true
letneedUpgrade=true
// if (/\b_update_\b/.test(apt)) {
msSt=grpSt('apt-get update')
execSync(`sudo apt-get ${opts} -qy update`)
grpEnd(msSt)
apt=apt.replace(/\b_update_\b/gi,'').trim()
needUpdate=false
// }
if(/\b_dist-upgrade_\b/.test(apt)){
msSt=grpSt('apt-get dist-upgrade')
if(needUpdate){execSync('sudo apt-get -qy update')}
execSync(`sudo apt-get ${opts} -qy dist-upgrade`)
grpEnd(msSt)
needUpgrade=false
apt=apt.replace(/\b_dist-upgrade_\b/gi,'').trim()
}
if(/\b_upgrade_\b/.test(apt)){
if(needUpgrade){
msSt=grpSt('apt-get upgrade')
if(needUpdate){execSync(`sudo apt-get ${opts} -qy update`)}
execSync(`sudo apt-get ${opts} -qy upgrade`)
grpEnd(msSt)
}
apt=apt.replace(/\b_upgrade_\b/gi,'').trim()
}
if(apt!==''){
msSt=grpSt(`apt-get ${apt}`)
execSync(`sudo apt-get ${opts} -qy --no-install-recommends install ${apt}`)
grpEnd(msSt)
}
}
}catch(error){
core.setFailed(error.message)
}
}