1
1
// Running a script that sets everything up
2
2
3
3
const exec = require ( '@actions/exec' ) ;
4
- const core = require ( '@actions/core' )
4
+ const core = require ( '@actions/core' ) ;
5
+
6
+ function error ( message ) {
7
+ core . setFailed ( message ) ;
8
+ process . exit ( 1 ) ;
9
+ }
5
10
6
11
async function installPkg ( pkgname ) {
7
12
let attempts = 0 ;
@@ -12,8 +17,7 @@ async function installPkg(pkgname) {
12
17
break ;
13
18
} catch ( error ) {
14
19
if ( attempts > 3 ) {
15
- core . setFailed ( "Something went wrong :/" ) ;
16
- process . exit ( 1 ) ;
20
+ error ( "Something went wrong :/" ) ;
17
21
}
18
22
attempts += 1 ;
19
23
continue ;
@@ -22,10 +26,22 @@ async function installPkg(pkgname) {
22
26
}
23
27
24
28
async function start ( ) {
29
+ let myOutput = '' ;
30
+ await exec . exec ( "grep" , [ "^DISTRIB_RELEASE=" , "/etc/lsb-release" ] , {
31
+ listeners : {
32
+ stdout : ( data ) => {
33
+ myOutput += data . toString ( ) ;
34
+ }
35
+ }
36
+ } ) ;
37
+ if ( myOutput . split ( "=" ) . at ( - 1 ) . split ( "." ) . at ( 0 ) != "24" ) {
38
+ error ( "old version of ubuntu, must be version 24 of ubuntu" ) ;
39
+ }
40
+
25
41
await installPkg ( "libarchive-tools" ) ;
26
42
27
- await exec . exec ( "sudo su -c \"echo 'deb http://archive.ubuntu.com/ubuntu/ lunar universe' > /etc/apt/sources.list.d/lunar .list\"" ) ;
28
- await exec . exec ( "sudo su -c \"echo 'deb-src http://archive.ubuntu.com/ubuntu/ lunar universe' >> /etc/apt/sources.list.d/lunar .list\"" ) ;
43
+ await exec . exec ( "sudo su -c \"echo 'deb http://archive.ubuntu.com/ubuntu/ oracular universe' > /etc/apt/sources.list.d/oracular .list\"" ) ;
44
+ await exec . exec ( "sudo su -c \"echo 'deb-src http://archive.ubuntu.com/ubuntu/ oracular universe' >> /etc/apt/sources.list.d/oracular .list\"" ) ;
29
45
30
46
await installPkg ( "pacman-package-manager" ) ;
31
47
}
0 commit comments