Browse Source

feat(install): dependency refactor (#3568)

* adding data files

* adding old code back in

* added csv download code

* added debian 11

* distro detection bug

* file github

* adding url checking

* check url

* check dl

* file_url to fileurl

* remove infinite loop

* correct message

* adding file checking

* impove dep checking logic for unsupported distros

* logic

* add missing dep menu

* using update_steamcmd.sh

* added remote location

* download csv file

* download

* logic

* more logic

* speed up dependency loop

* message type change

* remove legacy code

* command only listed on install

* remove nl

* remove check requirement on stop

* missing vints

vints

* add debian based servers

* eco

* add centos8

* mono changes

* correct centos8 csv

* centos 8 fixes

* almalinux-8.4

* add centos 7 and rocky 8

* add dnf and email deps

* add steamcmd requirements

* steamcmd requirements

* dependencysteamcmd

* prevent masterserver from checking more than once per command

* uniq sort dependency array

* re-word of mono repo install

* prevent too many steam api querys

* java and mono check logic

* unset depstatus

* mono status

* java versions

* java wildcard

* depstatus


* bug

* add dodr

* remove i386 command if not needed

* added rhel

* 8.4 to just 8


* added Valheim Plus requriements
pull/3576/head
Daniel Gibbs 4 years ago
committed by GitHub
parent
commit
f289ebe560
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 120
      lgsm/data/almalinux-8.csv
  2. 120
      lgsm/data/centos-7.csv
  3. 120
      lgsm/data/centos-8.csv
  4. 120
      lgsm/data/debian-10.csv
  5. 120
      lgsm/data/debian-11.csv
  6. 120
      lgsm/data/debian-9.csv
  7. 120
      lgsm/data/rhel-7.csv
  8. 120
      lgsm/data/rhel-8.csv
  9. 120
      lgsm/data/rocky-8.csv
  10. 120
      lgsm/data/ubuntu-16.04.csv
  11. 120
      lgsm/data/ubuntu-18.04.csv
  12. 121
      lgsm/data/ubuntu-20.04.csv
  13. 120
      lgsm/data/ubuntu-21.04.csv
  14. 2
      lgsm/functions/check.sh
  15. 705
      lgsm/functions/check_deps.sh
  16. 146
      lgsm/functions/core_dl.sh
  17. 194
      lgsm/functions/info_distro.sh
  18. 21
      lgsm/functions/info_game.sh
  19. 1
      lgsm/functions/install_config.sh
  20. 1
      lgsm/functions/install_server_dir.sh
  21. 1
      lgsm/functions/install_server_files.sh

120
lgsm/data/almalinux-8.csv

@ -0,0 +1,120 @@
all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl.i686
bd
bf1942,ncurses-libs.i686
bfv,compat-libstdc++-33.i686,glibc.i686
bmdm,ncurses-libs.i686
bo
bs
bt,libicu
bt1944
cc
cmw
cod,compat-libstdc++-33.i686
cod2,compat-libstdc++-33.i686
cod4
coduo,compat-libstdc++-33.i686
codwaw
col
cs
cscz
csgo
css,ncurses-libs.i686
dab
dmc
dod
dodr
dods
doi
dst,libcurl.i686
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,ncurses-libs.i686
hl2dm
hldm
hldms
hw,zlib-devel
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,java-11-openjdk
mcb,libnsl
mh
mohaa,compat-libstdc++-33.i686
mom
mta
mumble
nd
nmrih,ncurses-libs.i686
ns
ns2,speex,tbb
ns2c,speex.i686,tbb.i686
onset,mariadb-connector-c
opfor
pc
pmc,java-11-openjdk
pstbs,GConf2
pvkii
pvr,libcxx
pz,java-11-openjdk rng-tools
q2
q3
ql
qw
ricochet
ro
rtcw
rust,zlib-devel
rw,java-11-openjdk
samp
sb
sbots
scpsl
scpslsm
sdtd,telnet,expect
sfc,ncurses-libs.i686
sof2
sol
squad
st
sven
terraria
tf2,libcurl.i686
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,glibc-devel
vs
vints,mono-complete
wet
wf
wmc,java-11-openjdk
wurm,xorg-x11-server-Xvfb
zmr,ncurses-libs.i686
zps,ncurses-libs.i686
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/centos-7.csv

@ -0,0 +1,120 @@
all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl.i686
bd
bf1942,ncurses-libs.i686
bfv,compat-libstdc++-33.i686,glibc.i686
bmdm,ncurses-libs.i686
bo
bs
bt,libicu
bt1944
cc
cmw
cod,compat-libstdc++-33.i686
cod2,compat-libstdc++-33.i686
cod4
coduo,compat-libstdc++-33.i686
codwaw
col
cs
cscz
csgo
css,ncurses-libs.i686
dab
dmc
dod
dodr
dods
doi
dst,libcurl.i686
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,ncurses-libs.i686
hl2dm
hldm
hldms
hw,zlib-devel
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,java-11-openjdk
mcb,libnsl
mh
mohaa,compat-libstdc++-33.i686
mom
mta
mumble
nd
nmrih,ncurses-libs.i686
ns
ns2,speex,tbb
ns2c,speex.i686,tbb.i686
onset,mariadb-connector-c
opfor
pc
pmc,java-11-openjdk
pstbs,GConf2
pvkii
pvr,libcxx
pz,java-11-openjdk rng-tools
q2
q3
ql
qw
ricochet
ro
rtcw
rust,zlib-devel
rw,java-11-openjdk
samp
sb
sbots
scpsl
scpslsm
sdtd,telnet,expect
sfc,ncurses-libs.i686
sof2
sol
squad
st
sven
terraria
tf2,libcurl.i686
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,glibc-devel
vs
vints,mono-complete
wet
wf
wmc,java-11-openjdk
wurm,xorg-x11-server-Xvfb
zmr,ncurses-libs.i686
zps,ncurses-libs.i686
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/centos-8.csv

@ -0,0 +1,120 @@
all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl.i686
bd
bf1942,ncurses-libs.i686
bfv,compat-libstdc++-33.i686,glibc.i686
bmdm,ncurses-libs.i686
bo
bs
bt,libicu
bt1944
cc
cmw
cod,compat-libstdc++-33.i686
cod2,compat-libstdc++-33.i686
cod4
coduo,compat-libstdc++-33.i686
codwaw
col
cs
cscz
csgo
css,ncurses-libs.i686
dab
dmc
dod
dodr
dods
doi
dst,libcurl.i686
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,ncurses-libs.i686
hl2dm
hldm
hldms
hw,zlib-devel
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,java-11-openjdk
mcb,libnsl
mh
mohaa,compat-libstdc++-33.i686
mom
mta
mumble
nd
nmrih,ncurses-libs.i686
ns
ns2,speex,tbb
ns2c,speex.i686,tbb.i686
onset,mariadb-connector-c
opfor
pc
pmc,java-11-openjdk
pstbs,GConf2
pvkii
pvr,libcxx
pz,java-11-openjdk rng-tools
q2
q3
ql
qw
ricochet
ro
rtcw
rust,zlib-devel
rw,java-11-openjdk
samp
sb
sbots
scpsl
scpslsm
sdtd,telnet,expect
sfc,ncurses-libs.i686
sof2
sol
squad
st
sven
terraria
tf2,libcurl.i686
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,glibc-devel
vs
vints,mono-complete
wet
wf
wmc,java-11-openjdk
wurm,xorg-x11-server-Xvfb
zmr,ncurses-libs.i686
zps,ncurses-libs.i686
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/debian-10.csv

@ -0,0 +1,120 @@
all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl4-gnutls-dev:i386
bd
bf1942,libncurses5:i386,libtinfo5:i386
bfv,libncurses5:i386,libstdc++5:i386
bmdm,libncurses5:i386
bo
bs
bt,libicu-dev
bt1944
cc
cmw
cod,libstdc++5:i386
cod2,libstdc++5:i386
cod4
coduo,libstdc++5:i386
codwaw
col
cs
cscz
csgo
css,libtinfo5:i386
dab
dmc
dod
dodr
dods
doi
dst,libcurl4-gnutls-dev:i386
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,libtinfo5:i386
hl2dm
hldm
hldms
hw,lib32z1
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,openjdk-11-jre
mcb
mh
mohaa,libstdc++5:i386
mom
mta
mumble
nd
nmrih,libtinfo5:i386
ns
ns2,speex,libtbb2
ns2c,speex:i386,libtbb2
onset
opfor
pc
pmc,openjdk-11-jre
pstbs,libgconf-2-4
pvkii
pvr,libc++1
pz
q2
q3
ql
qw
ricochet
ro
rtcw
rust,lib32z1
rw,openjdk-11-jre
samp
sb
sbots
scpsl,mono-complete
scpslsm,mono-complete
sdtd,telnet,expect
sfc,libtinfo5:i386
sof2
sol
squad
st
sven,libssl1.1:i386,zlib1g:i386
terraria
tf2,libcurl4-gnutls-dev:i386
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,libc6-dev
vs
vints,mono-complete
wet
wf
wmc,openjdk-11-jre
wurm,xvfb
zmr,libtinfo5:i386
zps,libtinfo5:i386
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/debian-11.csv

@ -0,0 +1,120 @@
all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc-s1,lib32stdc++6,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl4-gnutls-dev:i386
bd
bf1942,libncurses5:i386,libtinfo5:i386
bfv,libncurses5:i386,libstdc++5:i386
bmdm,libncurses5:i386
bo
bs
bt,libicu-dev
bt1944
cc
cmw
cod,libstdc++5:i386
cod2,libstdc++5:i386
cod4
coduo,libstdc++5:i386
codwaw
col
cs
cscz
csgo
css,libtinfo5:i386
dab
dmc
dod
dodr
dods
doi
dst,libcurl4-gnutls-dev:i386
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,libtinfo5:i386
hl2dm
hldm
hldms
hw,lib32z1
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,openjdk-16-jre
mcb
mh
mohaa,libstdc++5:i386
mom
mta
mumble
nd
nmrih,libtinfo5:i386
ns
ns2,speex,libtbb2
ns2c,speex:i386,libtbb2
onset
opfor
pc
pmc,openjdk-16-jre
pstbs,libgconf-2-4
pvkii
pvr,libc++1
pz
q2
q3
ql
qw
ricochet
ro
rtcw
rust,lib32z1
rw,openjdk-16-jre
samp
sb
sbots
scpsl,mono-complete
scpslsm,mono-complete
sdtd,telnet,expect
sfc,libtinfo5:i386
sof2
sol
squad
st
sven,libssl1.1:i386,zlib1g:i386
terraria
tf2,libcurl4-gnutls-dev:i386
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,libc6-dev
vs
vints,mono-complete
wet
wf
wmc,openjdk-16-jre
wurm,xvfb
zmr,libtinfo5:i386
zps,libtinfo5:i386
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/debian-9.csv

@ -0,0 +1,120 @@
all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl4-gnutls-dev:i386
bd
bf1942,libncurses5:i386,libtinfo5:i386
bfv,libncurses5:i386,libstdc++5:i386
bmdm,libncurses5:i386
bo
bs
bt,libicu-dev
bt1944
cc
cmw
cod,libstdc++5:i386
cod2,libstdc++5:i386
cod4
coduo,libstdc++5:i386
codwaw
col
cs
cscz
csgo
css,libtinfo5:i386
dab
dmc
dod
dodr
dods
doi
dst,libcurl4-gnutls-dev:i386
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,libtinfo5:i386
hl2dm
hldm
hldms
hw,lib32z1
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,openjdk-8-jre
mcb
mh
mohaa,libstdc++5:i386
mom
mta
mumble
nd
nmrih,libtinfo5:i386
ns
ns2,speex,libtbb2
ns2c,speex:i386,libtbb2
onset
opfor
pc
pmc,openjdk-8-jre
pstbs,libgconf-2-4
pvkii
pvr,libc++1
pz
q2
q3
ql
qw
ricochet
ro
rtcw
rust,lib32z1
rw,openjdk-8-jre
samp
sb
sbots
scpsl,mono-complete
scpslsm,mono-complete
sdtd,telnet,expect
sfc,libtinfo5:i386
sof2
sol
squad
st
sven,libssl1.1:i386,zlib1g:i386
terraria
tf2,libcurl4-gnutls-dev:i386
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,libc6-dev
vs
vints,mono-complete
wet
wf
wmc,openjdk-8-jre
wurm,xvfb
zmr,libtinfo5:i386
zps,libtinfo5:i386
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/rhel-7.csv

@ -0,0 +1,120 @@
all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl.i686
bd
bf1942,ncurses-libs.i686
bfv,compat-libstdc++-33.i686,glibc.i686
bmdm,ncurses-libs.i686
bo
bs
bt,libicu
bt1944
cc
cmw
cod,compat-libstdc++-33.i686
cod2,compat-libstdc++-33.i686
cod4
coduo,compat-libstdc++-33.i686
codwaw
col
cs
cscz
csgo
css,ncurses-libs.i686
dab
dmc
dod
dodr
dods
doi
dst,libcurl.i686
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,ncurses-libs.i686
hl2dm
hldm
hldms
hw,zlib-devel
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,java-11-openjdk
mcb,libnsl
mh
mohaa,compat-libstdc++-33.i686
mom
mta
mumble
nd
nmrih,ncurses-libs.i686
ns
ns2,speex,tbb
ns2c,speex.i686,tbb.i686
onset,mariadb-connector-c
opfor
pc
pmc,java-11-openjdk
pstbs,GConf2
pvkii
pvr,libcxx
pz,java-11-openjdk rng-tools
q2
q3
ql
qw
ricochet
ro
rtcw
rust,zlib-devel
rw,java-11-openjdk
samp
sb
sbots
scpsl
scpslsm
sdtd,telnet,expect
sfc,ncurses-libs.i686
sof2
sol
squad
st
sven
terraria
tf2,libcurl.i686
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,glibc-devel
vs
vints,mono-complete
wet
wf
wmc,java-11-openjdk
wurm,xorg-x11-server-Xvfb
zmr,ncurses-libs.i686
zps,ncurses-libs.i686
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/rhel-8.csv

@ -0,0 +1,120 @@
all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl.i686
bd
bf1942,ncurses-libs.i686
bfv,compat-libstdc++-33.i686,glibc.i686
bmdm,ncurses-libs.i686
bo
bs
bt,libicu
bt1944
cc
cmw
cod,compat-libstdc++-33.i686
cod2,compat-libstdc++-33.i686
cod4
coduo,compat-libstdc++-33.i686
codwaw
col
cs
cscz
csgo
css,ncurses-libs.i686
dab
dmc
dod
dodr
dods
doi
dst,libcurl.i686
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,ncurses-libs.i686
hl2dm
hldm
hldms
hw,zlib-devel
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,java-11-openjdk
mcb,libnsl
mh
mohaa,compat-libstdc++-33.i686
mom
mta
mumble
nd
nmrih,ncurses-libs.i686
ns
ns2,speex,tbb
ns2c,speex.i686,tbb.i686
onset,mariadb-connector-c
opfor
pc
pmc,java-11-openjdk
pstbs,GConf2
pvkii
pvr,libcxx
pz,java-11-openjdk rng-tools
q2
q3
ql
qw
ricochet
ro
rtcw
rust,zlib-devel
rw,java-11-openjdk
samp
sb
sbots
scpsl
scpslsm
sdtd,telnet,expect
sfc,ncurses-libs.i686
sof2
sol
squad
st
sven
terraria
tf2,libcurl.i686
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,glibc-devel
vs
vints,mono-complete
wet
wf
wmc,java-11-openjdk
wurm,xorg-x11-server-Xvfb
zmr,ncurses-libs.i686
zps,ncurses-libs.i686
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/rocky-8.csv

@ -0,0 +1,120 @@
all,epel-release,curl,wget,util-linux,python36,file,tar,gzip,bzip2,unzip,xz,binutils,bc,jq,tmux,nmap-ncat,cpio,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl.i686
bd
bf1942,ncurses-libs.i686
bfv,compat-libstdc++-33.i686,glibc.i686
bmdm,ncurses-libs.i686
bo
bs
bt,libicu
bt1944
cc
cmw
cod,compat-libstdc++-33.i686
cod2,compat-libstdc++-33.i686
cod4
coduo,compat-libstdc++-33.i686
codwaw
col
cs
cscz
csgo
css,ncurses-libs.i686
dab
dmc
dod
dodr
dods
doi
dst,libcurl.i686
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,ncurses-libs.i686
hl2dm
hldm
hldms
hw,zlib-devel
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,java-11-openjdk
mcb,libnsl
mh
mohaa,compat-libstdc++-33.i686
mom
mta
mumble
nd
nmrih,ncurses-libs.i686
ns
ns2,speex,tbb
ns2c,speex.i686,tbb.i686
onset,mariadb-connector-c
opfor
pc
pmc,java-11-openjdk
pstbs,GConf2
pvkii
pvr,libcxx
pz,java-11-openjdk rng-tools
q2
q3
ql
qw
ricochet
ro
rtcw
rust,zlib-devel
rw,java-11-openjdk
samp
sb
sbots
scpsl
scpslsm
sdtd,telnet,expect
sfc,ncurses-libs.i686
sof2
sol
squad
st
sven
terraria
tf2,libcurl.i686
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,glibc-devel
vs
vints,mono-complete
wet
wf
wmc,java-11-openjdk
wurm,xorg-x11-server-Xvfb
zmr,ncurses-libs.i686
zps,ncurses-libs.i686
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/ubuntu-16.04.csv

@ -0,0 +1,120 @@
all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl4-gnutls-dev:i386
bd
bf1942,libncurses5:i386,libtinfo5:i386
bfv,libncurses5:i386,libstdc++5:i386
bmdm,libncurses5:i386
bo
bs
bt,libicu-dev
bt1944
cc
cmw
cod,libstdc++5:i386
cod2,libstdc++5:i386
cod4
coduo,libstdc++5:i386
codwaw
col
cs
cscz
csgo
css,libtinfo5:i386
dab
dmc
dod
dodr
dods
doi
dst,libcurl4-gnutls-dev:i386
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,libtinfo5:i386
hl2dm
hldm
hldms
hw,lib32z1
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,openjdk-8-jre
mcb
mh
mohaa,libstdc++5:i386
mom
mta
mumble
nd
nmrih,libtinfo5:i386
ns
ns2,speex,libtbb2
ns2c,speex:i386,libtbb2
onset
opfor
pc
pmc,openjdk-8-jre
pstbs,libgconf-2-4
pvkii
pvr,libc++1
pz
q2
q3
ql
qw
ricochet
ro
rtcw
rust,lib32z1
rw,openjdk-8-jre
samp
sb
sbots
scpsl,mono-complete
scpslsm,mono-complete
sdtd,telnet,expect
sfc,libtinfo5:i386
sof2
sol
squad
st
sven,libssl1.1:i386,zlib1g:i386
terraria
tf2,libcurl4-gnutls-dev:i386
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,libc6-dev
vs
vints,mono-complete
wet
wf
wmc,openjdk-8-jre
wurm,xvfb
zmr,libtinfo5:i386
zps,libtinfo5:i386
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/ubuntu-18.04.csv

@ -0,0 +1,120 @@
all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl4-gnutls-dev:i386
bd
bf1942,libncurses5:i386,libtinfo5:i386
bfv,libncurses5:i386,libstdc++5:i386
bmdm,libncurses5:i386
bo
bs
bt,libicu-dev
bt1944
cc
cmw
cod,libstdc++5:i386
cod2,libstdc++5:i386
cod4
coduo,libstdc++5:i386
codwaw
col
cs
cscz
csgo
css,libtinfo5:i386
dab
dmc
dod
dodr
dods
doi
dst,libcurl4-gnutls-dev:i386
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,libtinfo5:i386
hl2dm
hldm
hldms
hw,lib32z1
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,openjdk-11-jre
mcb
mh
mohaa,libstdc++5:i386
mom
mta
mumble
nd
nmrih,libtinfo5:i386
ns
ns2,speex,libtbb2
ns2c,speex:i386,libtbb2
onset
opfor
pc
pmc,openjdk-11-jre
pstbs,libgconf-2-4
pvkii
pvr,libc++1
pz
q2
q3
ql
qw
ricochet
ro
rtcw
rust,lib32z1
rw,openjdk-11-jre
samp
sb
sbots
scpsl,mono-complete
scpslsm,mono-complete
sdtd,telnet,expect
sfc,libtinfo5:i386
sof2
sol
squad
st
sven,libssl1.1:i386,zlib1g:i386
terraria
tf2,libcurl4-gnutls-dev:i386
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,libc6-dev
vs
vints,mono-complete
wet
wf
wmc,openjdk-11-jre
wurm,xvfb
zmr,libtinfo5:i386
zps,libtinfo5:i386
Can't render this file because it has a wrong number of fields in line 2.

121
lgsm/data/ubuntu-20.04.csv

@ -0,0 +1,121 @@
all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc1,lib32stdc++6,hostname
steamcmd,lib32gcc1,lib32stdc++6,libsdl2-2.0-0:i386
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl4-gnutls-dev:i386
bd
bf1942,libncurses5:i386,libtinfo5:i386
bfv,libncurses5:i386,libstdc++5:i386
bmdm,libncurses5:i386
bo
bs
bt,libicu-dev
bt1944
cc
cmw
cod,libstdc++5:i386
cod2,libstdc++5:i386
cod4
coduo,libstdc++5:i386
codwaw
col
cs
cscz
csgo
css,libtinfo5:i386
dab
dmc
dod
dodr
dods
doi
dst,libcurl4-gnutls-dev:i386
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,libtinfo5:i386
hl2dm
hldm
hldms
hw,lib32z1
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,openjdk-16-jre
mcb
mh
mohaa,libstdc++5:i386
mom
mta
mumble
nd
nmrih,libtinfo5:i386
ns
ns2,speex,libtbb2
ns2c,speex:i386,libtbb2
onset
opfor
pc
pmc,openjdk-16-jre
pstbs,libgconf-2-4
pvkii
pvr,libc++1
pz
q2
q3
ql
qw
ricochet
ro
rtcw
rust,lib32z1
rw,openjdk-16-jre
samp
sb
sbots
scpsl,mono-complete
scpslsm,mono-complete
sdtd,telnet,expect
sfc,libtinfo5:i386
sof2
sol
squad
st
sven,libssl1.1:i386,zlib1g:i386
terraria
tf2,libcurl4-gnutls-dev:i386
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,libc6-dev
vs
vints,mono-complete
wet
wf
wmc,openjdk-16-jre
wurm,xvfb
zmr,libtinfo5:i386
zps,libtinfo5:i386
Can't render this file because it has a wrong number of fields in line 2.

120
lgsm/data/ubuntu-21.04.csv

@ -0,0 +1,120 @@
all,bc,binutils,bsdmainutils,bzip2,ca-certificates,cpio,curl,file,gzip,jq,python3,tar,tmux,util-linux,netcat,unzip,xz-utils,lib32gcc-s1,lib32stdc++6,hostname
ac
ahl
ahl2
ark
arma3
av
bb
bb2,libcurl4-gnutls-dev:i386
bd
bf1942,libncurses5:i386,libtinfo5:i386
bfv,libncurses5:i386,libstdc++5:i386
bmdm,libncurses5:i386
bo
bs
bt,libicu-dev
bt1944
cc
cmw
cod,libstdc++5:i386
cod2,libstdc++5:i386
cod4
coduo,libstdc++5:i386
codwaw
col
cs
cscz
csgo
css,libtinfo5:i386
dab
dmc
dod
dodr
dods
doi
dst,libcurl4-gnutls-dev:i386
dys
eco,libgdiplus
em
etl
fctr
fof
gmod,libtinfo5:i386
hl2dm
hldm
hldms
hw,lib32z1
ins
inss
ios
jc2
jc3
jk2
kf
kf2
lo
l4d
l4d2
mc,openjdk-16-jre
mcb
mh
mohaa,libstdc++5:i386
mom
mta
mumble
nd
nmrih,libtinfo5:i386
ns
ns2,speex,libtbb2
ns2c,speex:i386,libtbb2
onset
opfor
pc
pmc,openjdk-16-jre
pstbs,libgconf-2-4
pvkii
pvr,libc++1
pz
q2
q3
ql
qw
ricochet
ro
rtcw
rust,lib32z1
rw,openjdk-16-jre
samp
sb
sbots
scpsl,mono-complete
scpslsm,mono-complete
sdtd,telnet,expect
sfc,libtinfo5:i386
sof2
sol
squad
st
sven,libssl1.1:i386,zlib1g:i386
terraria
tf2,libcurl4-gnutls-dev:i386
tfc
ts
ts3
tu
tw
unt
ut
ut2k4
ut3
ut99
vh,libc6-dev
vs
vints,mono-complete
wet
wf
wmc,openjdk-16-jre
wurm,xvfb
zmr,libtinfo5:i386
zps,libtinfo5:i386
Can't render this file because it has a wrong number of fields in line 2.

2
lgsm/functions/check.sh

@ -54,7 +54,7 @@ for allowed_command in "${allowed_commands_array[@]}"; do
fi
done
allowed_commands_array=( DEBUG START STOP )
allowed_commands_array=( DEBUG START )
for allowed_command in "${allowed_commands_array[@]}"; do
if [ "${allowed_command}" == "${commandname}" ]; then
check_deps.sh

705
lgsm/functions/check_deps.sh

@ -3,204 +3,85 @@
# Author: Daniel Gibbs
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Checks if required dependencies are installed for LinuxGSM.
# Description: Checks and installs missing dependencies.
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_install_mono_repo(){
if [ "${monostatus}" != "0" ]; then
fn_print_dots "Adding Mono repository"
if [ "${autoinstall}" == "1" ]; then
sudo -n true > /dev/null 2>&1
else
sudo -v > /dev/null 2>&1
fi
if [ $? -eq 0 ]; then
fn_print_info_nl "Automatically adding Mono repository."
fn_script_log_info "Automatically adding Mono repository."
echo -en ".\r"
sleep 1
echo -en "..\r"
sleep 1
echo -en "...\r"
sleep 1
echo -en " \r"
if [ "${distroid}" == "ubuntu" ]; then
if [ "${distroversion}" == "18.04" ]; then
cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
eval "${cmd}"
elif [ "${distroversion}" == "16.04" ]; then
cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt-get install apt-transport-https;echo 'deb https://download.mono-project.com/repo/ubuntu stable-xenial main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
eval "${cmd}"
elif [ "${distroversion}" == "14.04" ]; then
cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt-get install apt-transport-https;echo 'deb https://download.mono-project.com/repo/ubuntu stable-trusty main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
eval "${cmd}"
else
fn_print_warn_nl "Installing Mono repository."
echo -e "Mono auto install not available for ${distroname}"
echo -e " Follow instructions on mono site to install the latest version of Mono."
echo -e " https://www.mono-project.com/download/stable/#download-lin"
monoautoinstall="1"
fi
elif [ "${distroid}" == "debian" ]; then
if [ "${distroversion}" == "10" ]; then
cmd="sudo apt-get install apt-transport-https dirmngr;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-buster main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
eval "${cmd}"
elif [ "${distroversion}" == "9" ]; then
cmd="sudo apt-get install apt-transport-https dirmngr;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-stretch main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
eval "${cmd}"
elif [ "${distroversion}" == "8" ]; then
cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt-get install apt-transport-https;echo 'deb https://download.mono-project.com/repo/debian stable-jessie main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt-get update"
eval "${cmd}"
else
echo -e "Mono auto install not available for ${distroname}"
echo -e " Follow instructions on mono site to install the latest version of Mono."
echo -e " https://www.mono-project.com/download/stable/#download-lin"
monoautoinstall="1"
fi
elif [ "${distroid}" == "centos" ]; then
if [ "${distroversion}" == "8" ]; then
cmd="rpm --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF';su -c 'curl https://download.mono-project.com/repo/centos8-stable.repo | tee /etc/yum.repos.d/mono-centos8-stable.repo'"
eval "${cmd}"
elif [ "${distroversion}" == "7" ]; then
cmd="rpm --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF';su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'"
eval "${cmd}"
else
echo -e "Mono auto install not available for ${distroname}"
echo -e " Follow instructions on mono site to install the latest version of Mono."
echo -e " https://www.mono-project.com/download/stable/#download-lin"
monoautoinstall="1"
fi
elif [ "${distroid}" == "fedora" ]; then
cmd="rpm --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF'; su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'; dnf update"
eval "${cmd}"
if [ "${autodepinstall}" == "0" ]; then
fn_print_information_nl "Automatically adding Mono repository."
fn_script_log_info "Automatically adding Mono repository."
echo -en ".\r"
sleep 1
echo -en "..\r"
sleep 1
echo -en "...\r"
sleep 1
echo -en " \r"
if [ "${distroid}" == "ubuntu" ]; then
if [ "${distroversion}" == "20.04" ]; then
cmd="sudo apt install gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-focal main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
elif [ "${distroversion}" == "18.04" ]; then
cmd="sudo apt install gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
elif [ "${distroversion}" == "16.04" ]; then
cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt install apt-transport-https ca-certificates;echo 'deb https://download.mono-project.com/repo/ubuntu stable-xenial main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
else
echo -e "Mono auto install not available for ${distroname}"
echo -e " Follow instructions on mono site to install the latest version of Mono."
echo -e " https://www.mono-project.com/download/stable/#download-lin"
monoautoinstall="1"
fi
if [ "${monoautoinstall}" != "1" ]; then
if [ $? != 0 ]; then
fn_print_failure_nl "Unable to install Mono repository."
fn_script_log_fatal "Unable to installMono repository."
monoautoinstall=1
else
fn_print_complete_nl "Installing Mono repository completed."
fn_script_log_pass "Installing Mono repository completed."
monoautoinstall=0
fi
elif [ "${distroid}" == "debian" ]; then
if [ "${distroversion}" == "10" ]; then
cmd="sudo apt install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-buster main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
elif [ "${distroversion}" == "9" ]; then
cmd="sudo apt install apt-transport-https dirmngr gnupg ca-certificates;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-stretch main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
else
monoautoinstall="1"
fi
else
fn_print_information_nl "Installing Mono repository."
echo -e ""
fn_print_warning_nl "$(whoami) does not have sudo access. Manually install Mono repository."
fn_script_log_warn "$(whoami) does not have sudo access. Manually install Mono repository."
echo -e "* Follow instructions on mono site to install the latest version of Mono."
echo -e " https://www.mono-project.com/download/stable/#download-lin"
fi
fi
}
fn_install_universe_repo(){
# Defensive coding - As this is an ubuntu only issue then check to make sure this fix is needed, and we are using ubuntu.
if [ "${jquniversemissing}" != "0" ]&&[ "${distroid}" == "ubuntu" ]; then
fn_print_warning_nl "Ubuntu 18.04.1 contains a bug which means the sources.list file does not populate with the Ubuntu universe repository."
fn_print_information_nl "Attempting to add universe repository."
if [ "${autoinstall}" == "1" ]; then
sudo -n true > /dev/null 2>&1
else
sudo -v > /dev/null 2>&1
fi
if [ $? -eq 0 ]; then
echo -en ".\r"
sleep 1
echo -en "..\r"
sleep 1
echo -en "...\r"
sleep 1
echo -en " \r"
cmd="sudo apt-add-repository universe"
eval "${cmd}"
if [ $? -eq 0 ]; then
fn_print_complete_nl "Installing universe repository completed."
fn_script_log_pass "Installing universe repository completed."
elif [ "${distroid}" == "centos" ]||[ "${distroid}" == "almalinux" ]||[ "${distroid}" == "rocky" ]; then
if [ "${distroversion}" == "8" ]; then
cmd="sudo rpmkeys --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF';su -c 'curl https://download.mono-project.com/repo/centos8-stable.repo | tee /etc/yum.repos.d/mono-centos8-stable.repo'"
elif [ "${distroversion}" == "7" ]; then
cmd="sudo rpmkeys --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF';su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'"
else
monoautoinstall="1"
fi
elif [ "${distroid}" == "fedora" ]; then
if [ "${distroversion}" -ge "29" ]; then
cmd="sudo rpm --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF';su -c 'curl https://download.mono-project.com/repo/centos8-stable.repo | tee /etc/yum.repos.d/mono-centos8-stable.repo';dnf update"
else
fn_print_failure_nl "Unable to install universe repository."
fn_script_log_fatal "Unable to install universe repository."
cmd="sudo rpm --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF';su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo';dnf update"
fi
else
fn_print_warning_nl "$(whoami) does not have sudo access. Manually add Universe repository."
fn_script_log_warn "$(whoami) does not have sudo access. Manually add Universe repository."
echo -e "* Please run the following command as a user with sudo access, and re-run the installation"
echo -e ""
echo -e " sudo apt-add-repository universe"
monoautoinstall="1"
fi
fi
}
fn_deps_detector(){
# Checks if dependency is missing.
if [ "${javacheck}" == "1" ]; then
# Added for users using Oracle JRE to bypass check.
depstatus=0
deptocheck="${javaversion}"
unset javacheck
elif [ "${deptocheck}" == "jq" ]&&[ "${distroid}" == "ubuntu" ]&&[ "${distroversion}" == "18.04" ]&& ! grep -qE "^deb .*universe" /etc/apt/sources.list; then
# #1985 ubuntu 18.04.1 bug does not set sources.list correctly which means universe is not active by default
# If the universe repo does not exist, mark as dependency missing and universe missing.
depstatus=1
jquniversemissing=1
elif [ "${deptocheck}" == "mono-complete" ]; then
if [ "$(command -v mono 2>/dev/null)" ]&&[ "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]; then
# Mono >= 5.0.0 already installed.
depstatus=0
else
# Mono not installed or installed Mono < 5.0.0.
depstatus=1
monostatus=1
fi
elif [ "$(command -v dpkg-query 2>/dev/null)" ]; then
dpkg-query -W -f='${Status}' "${deptocheck}" 2>/dev/null | grep -q -P '^install ok installed'
depstatus=$?
elif [ "$(command -v rpm 2>/dev/null)" ]; then
rpm -q "${deptocheck}" > /dev/null 2>&1
depstatus=$?
fi
# Run the mono repo install.
eval "${cmd}"
if [ "${depstatus}" == "0" ]; then
# If dependency is found.
missingdep=0
if [ "${commandname}" == "INSTALL" ]; then
echo -e "${green}${deptocheck}${default}"
fn_sleep_time
fi
else
# If dependency is not found.
missingdep=1
if [ "${commandname}" == "INSTALL" ]; then
echo -e "${red}${deptocheck}${default}"
fn_sleep_time
fi
# Define required dependencies for SteamCMD.
if [ "${appid}" ]; then
# lib32gcc1 is now called lib32gcc-s1 in debian 11
if { [ "${distroid}" == "debian" ]&&[ "${distroversion}" == "11" ]; }||{ [ "${distroid}" == "ubuntu" ]&&[ "${distroversion}" == "20.10" ]; } || { [ "${distroid}" == "pop" ]&&[ "${distroversion}" == "20.10" ]; }; then
if [ "${deptocheck}" == "glibc.i686" ]||[ "${deptocheck}" == "libstdc++64.i686" ]||[ "${deptocheck}" == "lib32gcc-s1" ]||[ "${deptocheck}" == "lib32stdc++6" ]; then
steamcmdfail=1
fi
# Did Mono repo install correctly?
if [ "${monoautoinstall}" != "1" ]; then
if [ $? != 0 ]; then
fn_print_failure_nl "Unable to install Mono repository."
fn_script_log_fatal "Unable to install Mono repository."
else
if [ "${deptocheck}" == "glibc.i686" ]||[ "${deptocheck}" == "libstdc++64.i686" ]||[ "${deptocheck}" == "lib32gcc1" ]||[ "${deptocheck}" == "lib32stdc++6" ]; then
steamcmdfail=1
fi
fn_print_complete_nl "Installing Mono repository completed."
fn_script_log_pass "Installing Mono repository completed."
fi
fi
fi
# Missing dependencies are added to array_deps_missing.
if [ "${missingdep}" == "1" ]; then
array_deps_missing+=("${deptocheck}")
# Mono can not be auto installed with this distro.
if [ "${monoautoinstall}" == "1" ]; then
fn_print_warning_nl "Mono auto install not available for ${distroname}."
echo -e "Follow instructions on Mono website to install."
echo -e "https://www.mono-project.com/download/stable/#download-lin"
fn_script_log_warn "Unable to install Mono repository. Mono auto install not available for ${distroname}."
fi
else
fn_print_information_nl "Installing Mono repository."
fn_print_warning_nl "$(whoami) does not have sudo access."
echo -e "Follow instructions on Mono website to install."
echo -e "https://www.mono-project.com/download/stable/#download-lin"
fn_script_log_warn "Unable to install Mono repository. $(whoami) does not have sudo access."
fi
}
@ -227,25 +108,51 @@ fn_deps_email(){
fi
}
fn_found_missing_deps(){
fn_install_missing_deps(){
# If any dependencies are not installed.
if [ "${#array_deps_missing[*]}" != "0" ]; then
fn_print_warning_nl "Missing dependencies: ${red}${array_deps_missing[*]}${default}"
fn_script_log_warn "Missing dependencies: ${array_deps_missing[*]}"
fn_sleep_time
if [ "${monostatus}" ]; then
fn_install_mono_repo
fi
if [ "${jqstatus}" ]; then
fn_print_warning_nl "jq is not available in the ${distroname} repository."
echo -e " * https://docs.linuxgsm.com/requirements/jq"
if [ "${commandname}" == "INSTALL" ]; then
fn_print_warning_nl "Missing dependencies: ${red}${array_deps_missing[*]}${default}"
fn_script_log_warn "Missing dependencies: ${array_deps_missing[*]}"
else
fn_print_dots "Missing dependencies"
fn_print_warn "Missing dependencies: ${red}${array_deps_missing[*]}${default}"
fn_script_log_warn "Missing dependencies: ${array_deps_missing[*]}"
fi
fn_sleep_time
# Attempt automatic dependency installation
if [ "${autoinstall}" == "1" ]; then
sudo -n true > /dev/null 2>&1
else
sudo -v > /dev/null 2>&1
fi
if [ $? -eq 0 ]; then
autodepinstall="$?"
if [ "${monostatus}" == "1" ]; then
fn_install_mono_repo
fi
if [ "${commandname}" == "INSTALL" ]; then
if [ "${autodepinstall}" == "0" ]; then
fn_print_information_nl "$(whoami) has sudo access."
fn_script_log_info "$(whoami) has sudo access."
else
fn_print_warning_nl "$(whoami) does not have sudo access. Manually install dependencies."
fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies."
fi
fi
# Add sudo dpkg --add-architecture i386 if using i386 packages.
if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
if printf '%s\n' "${array_deps_required[@]}" | grep -q -P 'i386'; then
i386installcommand="sudo dpkg --add-architecture i386; "
fi
fi
# If automatic dependency install is available
if [ "${autodepinstall}" == "0" ]; then
fn_print_information_nl "Automatically installing missing dependencies."
fn_script_log_info "Automatically installing missing dependencies."
echo -en ".\r"
@ -256,7 +163,7 @@ fn_found_missing_deps(){
sleep 1
echo -en " \r"
if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
cmd="echo steamcmd steam/question select \"I AGREE\" | sudo debconf-set-selections; echo steamcmd steam/license note '' | sudo debconf-set-selections; sudo dpkg --add-architecture i386; sudo apt-get update; sudo apt-get -y install ${array_deps_missing[*]}"
cmd="echo steamcmd steam/question select \"I AGREE\" | sudo debconf-set-selections; echo steamcmd steam/license note '' | sudo debconf-set-selections; ${i386installcommand}sudo apt-get update; sudo apt-get -y install ${array_deps_missing[*]}"
eval "${cmd}"
elif [ "$(command -v dnf 2>/dev/null)" ]; then
cmd="sudo dnf -y install ${array_deps_missing[*]}"
@ -265,61 +172,31 @@ fn_found_missing_deps(){
cmd="sudo yum -y install ${array_deps_missing[*]}"
eval "${cmd}"
fi
if [ $? != 0 ]; then
fn_print_failure_nl "Unable to install dependencies."
fn_script_log_fatal "Unable to install dependencies."
echo -e ""
fn_print_warning_nl "Manually install dependencies."
fn_script_log_warn "Manually install dependencies."
if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
echo -e " sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[*]}"
elif [ "$(command -v dnf 2>/dev/null)" ]; then
echo -e " sudo dnf install ${array_deps_missing[*]}"
elif [ "$(command -v yum 2>/dev/null)" ]; then
echo -e " sudo yum install ${array_deps_missing[*]}"
fi
if [ "${steamcmdfail}" ]; then
echo -e ""
if [ "${commandname}" == "INSTALL" ]; then
fn_print_failure_nl "Missing dependencies required to run SteamCMD."
fn_script_log_fatal "Missing dependencies required to run SteamCMD."
core_exit.sh
else
fn_print_error_nl "Missing dependencies required to run SteamCMD."
fn_script_log_error "Missing dependencies required to run SteamCMD."
fi
fi
else
fn_print_complete_nl "Install dependencies completed."
fn_script_log_pass "Install dependencies completed."
fi
else
fn_print_warning_nl "$(whoami) does not have sudo access. Manually install dependencies."
fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies."
echo -e ""
autodepinstall="$?"
fi
# If automatic dependency install is unavailable.
if [ "${autodepinstall}" != "0" ]; then
if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
echo -e "sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[*]}"
echo -e "${i386installcommand}sudo apt update; sudo apt install ${array_deps_missing[*]}"
elif [ "$(command -v dnf 2>/dev/null)" ]; then
echo -e "sudo dnf install ${array_deps_missing[*]}"
elif [ "$(command -v yum 2>/dev/null)" ]; then
echo -e "sudo yum install ${array_deps_missing[*]}"
fi
if [ "${steamcmdfail}" ]; then
echo -e ""
if [ "${commandname}" == "INSTALL" ]; then
fn_print_failure_nl "Missing dependencies required to run SteamCMD."
fn_script_log_fatal "Missing dependencies required to run SteamCMD."
core_exit.sh
else
fn_print_error_nl "Missing dependencies required to run SteamCMD."
fn_script_log_error "Missing dependencies required to run SteamCMD."
fi
fi
echo -e ""
fi
if [ "${commandname}" == "INSTALL" ]; then
sleep 5
if [ "${steamcmdfail}" ]; then
if [ "${commandname}" == "INSTALL" ]; then
fn_print_failure_nl "Missing dependencies required to run SteamCMD."
fn_script_log_fatal "Missing dependencies required to run SteamCMD."
core_exit.sh
else
fn_print_error_nl "Missing dependencies required to run SteamCMD."
fn_script_log_error "Missing dependencies required to run SteamCMD."
fi
fi
else
if [ "${commandname}" == "INSTALL" ]; then
fn_print_information_nl "Required dependencies already installed."
@ -329,272 +206,79 @@ fn_found_missing_deps(){
}
fn_check_loop(){
# Loop though required depenencies.
# Loop though required depenencies checking if they are installed.
for deptocheck in ${array_deps_required[*]}; do
fn_deps_detector
done
# user to be informed of any missing dependencies.
fn_found_missing_deps
# user will be informed of any missing dependencies.
fn_install_missing_deps
}
# Generate require dependencies for debian based systems.
fn_deps_build_debian(){
# Generate array of missing deps.
array_deps_missing=()
# LinuxGSM requirements.
array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python3 tar bzip2 gzip unzip binutils bc jq tmux netcat cpio )
# All servers except ts3, mumble, GTA and minecraft servers require lib32stdc++6 and lib32gcc1.
if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${shortname}" != "pmc" ]&&[ "${shortname}" != "wmc" ]&&[ "${engine}" != "renderware" ]; then
if [ "${arch}" == "x86_64" ]; then
# lib32gcc1 is now called lib32gcc-s1 in debian 11
if { [ "${distroid}" == "debian" ]&&[ "${distroversion}" == "11" ]; }||{ [ "${distroid}" == "ubuntu" ]&&[ "${distroversion}" == "20.10" ]; }||{ [ "${distroid}" == "pop" ]&&[ "${distroversion}" == "20.10" ]; }; then
array_deps_required+=( lib32gcc-s1 lib32stdc++6 )
else
array_deps_required+=( lib32gcc1 lib32stdc++6 )
fi
else
array_deps_required+=( lib32stdc++6 )
fi
fi
# If requires steamcmd.
if [ "${appid}" ]; then
# Will not use apt if non-free repo is missing or Ubuntu 14.04
if [ "${distroversion}" == "14.04" ]||[ "${distroid}" == "debian" ]&& ! grep -qE "^deb .*non-free" /etc/apt/sources.list; then
:
else
array_deps_required+=( steamcmd libsdl2-2.0-0:i386 )
fi
fi
# Game Specific requirements.
# Natural Selection 2 (x64 only)
if [ "${shortname}" == "ns2" ]; then
array_deps_required+=( speex libtbb2 )
# NS2: Combat
elif [ "${shortname}" == "ns2c" ]; then
array_deps_required+=( speex:i386 libtbb2 )
# 7 Days to Die
elif [ "${shortname}" == "sdtd" ]; then
array_deps_required+=( telnet expect )
# Battlefield: Vietnam
elif [ "${shortname}" == "bfv" ]; then
array_deps_required+=( libncurses5:i386 libstdc++5:i386 )
# Battlefield 1942
elif [ "${shortname}" == "bf1942" ]; then
array_deps_required+=( libncurses5:i386 libtinfo5:i386 )
# Black Mesa: Death Match
elif [ "${shortname}" == "bmdm" ]; then
array_deps_required+=( libncurses5:i386 )
# Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source
elif [ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "zmr" ]||[ "${shortname}" == "zps" ]; then
if [ "${arch}" == "x86_64" ]; then
array_deps_required+=( libtinfo5:i386 )
else
array_deps_required+=( libtinfo5 )
fi
# Brainbread 2, Don't Starve Together & Team Fortress 2
elif [ "${shortname}" == "bb2" ]||[ "${shortname}" == "dst" ]||[ "${shortname}" == "tf2" ]; then
array_deps_required+=( libcurl4-gnutls-dev:i386 )
# Call of Duty & Medal of Honor: Allied Assault
elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]||[ "${shortname}" == "mohaa" ]; then
array_deps_required+=( libstdc++5:i386 )
# Barotrauma
elif [ "${shortname}" == "bt" ]; then
array_deps_required+=( libicu-dev )
# Ecoserver
elif [ "${shortname}" == "eco" ]; then
array_deps_required+=( libgdiplus )
# Factorio
elif [ "${shortname}" == "fctr" ]; then
array_deps_required+=( xz-utils )
# Hurtword/Rust
elif [ "${shortname}" == "hw" ]||[ "${shortname}" == "rust" ]; then
array_deps_required+=( lib32z1 )
# Minecraft, Rising World
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then
javaversion=$(java -version 2>&1 | grep "version")
if [ "${javaversion}" ]; then
# Added for users using Oracle JRE to bypass the check.
javacheck=1
else
if { [ "${distroid}" == "ubuntu" ]&&[ "${distroversion}" == "20.04" ]; }||{ [ "${distroid}" == "ubuntu" ]&&[ "${distroversion}" == "20.10" ]; }||{ [ "${distroid}" == "ubuntu" ]&&[ "${distroversion}" == "21.04" ]; }||{ [ "${distroid}" == "pop" ]&&[ "${distroversion}" == "20.04" ]; }||{ [ "${distroid}" == "pop" ]&&[ "${distroversion}" == "20.10" ]; }||{ [ "${distroid}" == "pop" ]&&[ "${distroversion}" == "21.04" ]; }; then
array_deps_required+=( openjdk-16-jre )
else
array_deps_required+=( default-jre )
fi
fi
elif [ "${shortname}" == "rw" ]; then
javaversion=$(java -version 2>&1 | grep "version")
if [ "${javaversion}" ]; then
# Added for users using Oracle JRE to bypass the check.
javacheck=1
# Checks if dependency is installed or not.
fn_deps_detector(){
# Java: Added for users using Oracle JRE to bypass check.
if [[ ${deptocheck} == "openjdk"* ]]||[[ ${deptocheck} == "java"* ]]; then
# Is java already installed?
if [ -n "${javaversion}" ]; then
# Added for users using Oracle JRE to bypass check.
depstatus=0
deptocheck="${javaversion}"
else
array_deps_required+=( default-jre )
depstatus=1
fi
# Onset
elif [ "${shortname}" == "onset" ]; then
array_deps_required+=( libmariadbclient-dev )
# Project Zomboid
elif [ "${shortname}" == "pz" ]; then
if java -version 2>&1 | grep "version"; then
# Added for users using Oracle JRE to bypass the check.
javacheck=1
array_deps_required+=( rng-tools )
# Mono: A Mono repo needs to be installed.
elif [ "${deptocheck}" == "mono-complete" ]; then
if [ -n "${monoversion}" ]&&[ "${monoversion}" -ge "5" ]; then
# Mono >= 5.0.0 already installed.
depstatus=0
monostatus=0
else
array_deps_required+=( default-jre rng-tools )
# Mono not installed or installed Mono < 5.0.0.
depstatus=1
monostatus=1
fi
# SCP: Secret Laboratory, SCP: Secret Laboratory ServerMod
elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then
array_deps_required+=( mono-complete )
# Sven Co-op
elif [ "${shortname}" == "sven" ]; then
array_deps_required+=( libssl1.1:i386 zlib1g:i386 )
# Vintage Story
elif [ "${shortname}" == "vints" ]; then
array_deps_required+=( mono-complete )
# Wurm: Unlimited
elif [ "${shortname}" == "wurm" ]; then
array_deps_required+=( xvfb )
# Post Scriptum
elif [ "${shortname}" == "pstbs" ]; then
array_deps_required+=( libgconf-2-4 )
# Pavlov VR
elif [ "${shortname}" == "pvr" ]; then
array_deps_required+=( libc++1 )
# Valheim ( for Plus mod)
elif [ "${shortname}" == "vh" ]; then
array_deps_required+=( libc6-dev )
elif [ "$(command -v dpkg-query 2>/dev/null)" ]; then
dpkg-query -W -f='${Status}' "${deptocheck}" 2>/dev/null | grep -q -P '^install ok installed'
depstatus=$?
elif [ "$(command -v dnf 2>/dev/null)" ]; then
dnf list installed "${deptocheck}" > /dev/null 2>&1
depstatus=$?
elif [ "$(command -v rpm 2>/dev/null)" ]; then
rpm -q "${deptocheck}" > /dev/null 2>&1
depstatus=$?
fi
# check if system is a lxc container and the hostname dependency.
if command -v systemd-detect-virt &> /dev/null; then
systemd_virt=$(systemd-detect-virt)
if [ "${systemd_virt}" == "lxc" ]||[ "${systemd_virt}" == "lxc-libvirt" ]; then
array_deps_required+=( hostname )
if [ "${depstatus}" == "0" ]; then
# If dependency is found.
missingdep=0
if [ "${commandname}" == "INSTALL" ]; then
echo -e "${green}${deptocheck}${default}"
sleep 0.1
fi
fi
fn_deps_email
fn_check_loop
}
fn_deps_build_redhat(){
# Generate array of missing deps.
array_deps_missing=()
# LinuxGSM requirements.
# CentOS
if [ "${distroversion}" == "7" ]; then
array_deps_required=( epel-release curl wget util-linux python3 file tar gzip bzip2 unzip binutils bc jq tmux nmap-ncat cpio )
elif [ "${distroversion}" == "8" ]; then
array_deps_required=( epel-release curl wget util-linux python36 file tar gzip bzip2 unzip binutils bc jq tmux nmap-ncat cpio )
elif [ "${distroid}" == "fedora" ]; then
array_deps_required=( curl wget util-linux python3 file tar gzip bzip2 unzip binutils bc jq tmux nmap-ncat cpio )
elif [[ "${distroname}" == *"Amazon Linux AMI"* ]]; then
array_deps_required=( curl wget util-linux python3 file tar gzip bzip2 unzip binutils bc jq tmux nmap-ncat cpio )
else
array_deps_required=( curl wget util-linux python3 file tar gzip bzip2 unzip binutils bc jq tmux nmap-ncat cpio )
fi
# All servers except ts3, mumble, multi theft auto and minecraft servers require glibc.i686 and libstdc++.i686.
if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then
if [[ "${distroname}" == *"Amazon Linux AMI"* ]]; then
array_deps_required+=( glibc.i686 libstdc++64.i686 )
else
array_deps_required+=( glibc.i686 libstdc++.i686 )
fi
fi
# Game Specific requirements.
# Natural Selection 2 (x64 only)
if [ "${shortname}" == "ns2" ]; then
array_deps_required+=( speex tbb )
# NS2: Combat
elif [ "${shortname}" == "ns2c" ]; then
array_deps_required+=( speex.i686 tbb.i686 )
# 7 Days to Die
elif [ "${shortname}" == "sdtd" ]; then
array_deps_required+=( telnet expect )
# Barotrauma
elif [ "${shortname}" == "bt" ]; then
array_deps_required+=( libicu )
# Battlefield: Vietnam
elif [ "${shortname}" == "bfv" ]; then
array_deps_required+=( compat-libstdc++-33.i686 glibc.i686 )
# Battlefield 1942, Black Mesa: Deathmatch, Counter-Strike: Source, Garry's Mod, No More Room in Hell, Source Forts Classic, Zombie Master Reborn and Zombie Panic: Source
elif [ "${shortname}" == "bf1942" ]||[ "${shortname}" == "bmdm" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "nmrih" ]||[ "${shortname}" == "sfc" ]||[ "${shortname}" == "zmr" ]||[ "${shortname}" == "zps" ]; then
array_deps_required+=( ncurses-libs.i686 )
# Brainbread 2, Don't Starve Together & Team Fortress 2
elif [ "${shortname}" == "bb2" ]||[ "${shortname}" == "dst" ]||[ "${shortname}" == "tf2" ]; then
array_deps_required+=( libcurl.i686 )
# Call of Duty & Medal of Honor: Allied Assault
elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]||[ "${shortname}" == "mohaa" ]; then
array_deps_required+=( compat-libstdc++-33.i686 )
# Ecoserver
elif [ "${shortname}" == "eco" ]; then
array_deps_required+=( libgdiplus )
# Factorio
elif [ "${shortname}" == "fctr" ]; then
array_deps_required+=( xz )
# Hurtword/Rust
elif [ "${shortname}" == "hw" ]||[ "${shortname}" == "rust" ]; then
array_deps_required+=( zlib-devel )
# Minecraft, Rising World, Wurm
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]||[ "${shortname}" == "rw" ]; then
javaversion=$(java -version 2>&1 | grep "version")
if [ "${javaversion}" ]; then
# Added for users using Oracle JRE to bypass the check.
javacheck=1
else
array_deps_required+=( java-11-openjdk )
# If dependency is not found.
missingdep=1
if [ "${commandname}" == "INSTALL" ]; then
echo -e "${red}${deptocheck}${default}"
sleep 0.1
fi
# Onset
elif [ "${shortname}" == "onset" ]; then
array_deps_required+=( mariadb-connector-c )
# Project Zomboid
elif [ "${shortname}" == "pz" ]; then
if java -version 2>&1 | grep "version"; then
# Added for users using Oracle JRE to bypass the check.
javacheck=1
array_deps_required+=( rng-tools )
else
array_deps_required+=( java-11-openjdk rng-tools )
# Define required dependencies for SteamCMD.
if [ -n "${appid}" ]; then
array_steamcmd_deps_required=("${depsteamcmd}")
for steamcmddeptocheck in ${array_steamcmd_deps_required[*]}; do
if [ "${deptocheck}" == "${steamcmddeptocheck}" ]; then
steamcmdfail=1
fi
done
fi
# Sven Co-op
elif [ "${shortname}" == "sven" ]; then
: # not compatible
# Vintage Story
elif [ "${shortname}" == "vints" ]; then
array_deps_required+=( mono-complete )
# Wurm: Unlimited
elif [ "${shortname}" == "wurm" ]; then
array_deps_required+=( xorg-x11-server-Xvfb )
# Post Scriptum
elif [ "${shortname}" == "pstbs" ]; then
array_deps_required+=( GConf2 )
# Pavlov VR
elif [ "${shortname}" == "pvr" ]; then
array_deps_required+=( libcxx )
# Valheim ( for Plus mod )
elif [ "${shortname}" == "vh" ]; then
array_deps_required+=( glibc-devel )
fi
unset depstatus
# check if system is a lxc container and the hostname dependency.
if command -v systemd-detect-virt &> /dev/null; then
systemd_virt=$(systemd-detect-virt)
if [ "${systemd_virt}" == "lxc" ]||[ "${systemd_virt}" == "lxc-libvirt" ]; then
array_deps_required+=( hostname )
fi
# Missing dependencies are added to array_deps_missing.
if [ "${missingdep}" == "1" ]; then
array_deps_missing+=("${deptocheck}")
fi
fn_deps_email
fn_check_loop
}
if [ "${commandname}" == "INSTALL" ]; then
@ -612,12 +296,45 @@ if [ "${commandname}" == "INSTALL" ]; then
fi
fi
# Filter checking in to Debian or Red Hat Based.
info_distro.sh
if [ -f "/etc/debian_version" ]; then
fn_deps_build_debian
elif [ -f "/etc/redhat-release" ]; then
fn_deps_build_redhat
else
fn_print_warning_nl "${distroname} dependency checking unavailable."
# some RHEL based distros use 8.4 instead of just 8.
if [[ "${distroidlike}" == *"rhel"* ]]||[ "${distroid}" == "rhel" ]; then
distroversion="${distroversionrh}"
fi
if [ ! -f "${tmpdir}/dependency-no-check.tmp" ]&&[ ! -f "${datadir}/${distroid}-${distroversion}.csv" ]; then
# Check that the disto dependency csv file exists.
fn_check_file_github "lgsm/data" "${distroid}-${distroversion}.csv"
if [ -n "${checkflag}" ]&&[ "${checkflag}" == "0" ]; then
fn_fetch_file_github "lgsm/data" "${distroid}-${distroversion}.csv" "lgsm/data" "chmodx" "norun" "noforce" "nohash"
fi
fi
# If the file successfully downloaded run the dependency check.
if [ -f "${datadir}/${distroid}-${distroversion}.csv" ]; then
depall=$(awk -F, '$1=="all" {$1=""; print $0}' "${datadir}/${distroid}-${distroversion}.csv")
depsteamcmd=$(awk -F, '$1=="steamcmd" {$1=""; print $0}' "${datadir}/${distroid}-${distroversion}.csv")
depshortname=$(awk -v shortname="$shortname" -F, '$1==shortname {$1=""; print $0}' "${datadir}/${distroid}-${distroversion}.csv")
# Generate array of missing deps.
array_deps_missing=()
array_deps_required=("${depall} ${depsteamcmd} ${depshortname}")
fn_deps_email
# Unique sort dependency array.
IFS=" " read -r -a array_deps_required <<< "$(echo "${array_deps_required[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
fn_check_loop
# Warn the user that dependency checking is unavailable for their distro.
elif [ "${commandname}" == "INSTALL" ]||[ -n "${checkflag}" ]&&[ "${checkflag}" != "0" ]; then
fn_print_warning_nl "LinuxGSM dependency checking currently unavailable for ${distroname}."
# Prevent future dependency checking if unavailable for the distro.
echo "${version}" > "${tmpdir}/dependency-no-check.tmp"
elif [ -f "${tmpdir}/dependency-no-check.tmp" ]; then
# Allow LinuxGSM to try a dependency check if LinuxGSM has been recently updated.
nocheckversion=$(cat "${tmpdir}/dependency-no-check.tmp")
if [ "${version}" != "${nocheckversion}" ]; then
rm -f "${tmpdir:?}/dependency-no-check.tmp"
fi
fi

146
lgsm/functions/core_dl.sh

@ -252,6 +252,75 @@ fn_fetch_trap(){
core_exit.sh
}
# Will check a file exists and download it. Will not exit if fails to download.
fn_check_file(){
remote_fileurl="${1}"
remote_fileurl_backup="${2}"
remote_fileurl_name="${3}"
remote_fileurl_backup_name="${4}"
remote_filename="${5}"
# If backup fileurl exists include it.
if [ -n "${remote_fileurl_backup}" ]; then
# counter set to 0 to allow second try
counter=0
remote_fileurls_array=( remote_fileurl remote_fileurl_backup )
else
# counter set to 1 to not allow second try
counter=1
remote_fileurls_array=( remote_fileurl )
fi
for remote_fileurl_array in "${remote_fileurls_array[@]}"; do
if [ "${remote_fileurl_array}" == "remote_fileurl" ]; then
fileurl="${remote_fileurl}"
fileurl_name="${remote_fileurl_name}"
elif [ "${remote_fileurl_array}" == "remote_fileurl_backup" ]; then
fileurl="${remote_fileurl_backup}"
fileurl_name="${remote_fileurl_backup_name}"
fi
counter=$((counter+1))
echo -en "checking ${fileurl_name} ${remote_filename}...\c"
curlcmd=$(curl --output /dev/null --silent --head --fail "${fileurl}" 2>&1)
local exitcode=$?
# On first try will error. On second try will fail.
if [ "${exitcode}" != 0 ]; then
if [ ${counter} -ge 2 ]; then
fn_print_fail_eol_nl
if [ -f "${lgsmlog}" ]; then
fn_script_log_fatal "Checking ${remote_filename}"
fn_script_log_fatal "${fileurl}"
checkflag=1
fi
else
fn_print_error_eol_nl
if [ -f "${lgsmlog}" ]; then
fn_script_log_error "Checking ${remote_filename}"
fn_script_log_error "${fileurl}"
checkflag=2
fi
fi
else
fn_print_ok_eol
sleep 0.3
echo -en "\033[2K\\r"
if [ -f "${lgsmlog}" ]; then
fn_script_log_pass "Checking ${remote_filename}"
checkflag=0
fi
break
fi
done
if [ -f "${local_filedir}/${local_filename}" ]; then
fn_dl_hash
# Execute file if run is set.
if [ "${run}" == "run" ]; then
# shellcheck source=/dev/null
source "${local_filedir}/${local_filename}"
fi
fi
}
fn_fetch_file(){
remote_fileurl="${1}"
remote_fileurl_backup="${2}"
@ -361,8 +430,8 @@ fn_fetch_file(){
# GitHub file download functions.
# Used to simplify downloading specific files from GitHub.
# github_file_url_dir: the directory of the file in the GitHub: lgsm/functions
# github_file_url_name: the filename of the file to download from GitHub: core_messages.sh
# github_fileurl_dir: the directory of the file in the GitHub: lgsm/functions
# github_fileurl_name: the filename of the file to download from GitHub: core_messages.sh
# githuburl: the full GitHub url
# remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2
@ -375,24 +444,24 @@ fn_fetch_file(){
# Fetches files from the Git repo.
fn_fetch_file_github(){
github_file_url_dir="${1}"
github_file_url_name="${2}"
github_fileurl_dir="${1}"
github_fileurl_name="${2}"
# For legacy versions - code can be removed at a future date
if [ "${legacymode}" == "1" ]; then
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
elif [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
fi
remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket"
local_filedir="${3}"
local_filename="${github_file_url_name}"
local_filename="${github_fileurl_name}"
chmodx="${4:-0}"
run="${5:-0}"
forcedl="${6:-0}"
@ -401,17 +470,32 @@ fn_fetch_file_github(){
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
}
fn_check_file_github(){
github_fileurl_dir="${1}"
github_fileurl_name="${2}"
if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
fi
remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket"
fn_check_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${github_fileurl_name}"
}
# Fetches config files from the Git repo.
fn_fetch_config(){
github_file_url_dir="${1}"
github_file_url_name="${2}"
github_fileurl_dir="${1}"
github_fileurl_name="${2}"
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
fi
remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket"
@ -427,20 +511,20 @@ fn_fetch_config(){
# Fetches modules from the Git repo during first download.
fn_fetch_function(){
github_file_url_dir="lgsm/functions"
github_file_url_name="${functionfile}"
github_fileurl_dir="lgsm/functions"
github_fileurl_name="${functionfile}"
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
fi
remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket"
local_filedir="${functionsdir}"
local_filename="${github_file_url_name}"
local_filename="${github_fileurl_name}"
chmodx="chmodx"
run="run"
forcedl="noforce"
@ -451,20 +535,20 @@ fn_fetch_function(){
# Fetches modules from the Git repo during update-lgsm.
fn_update_function(){
github_file_url_dir="lgsm/functions"
github_file_url_name="${functionfile}"
github_fileurl_dir="lgsm/functions"
github_fileurl_name="${functionfile}"
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
if [ "${githubbranch}" == "master" ]&&[ "${githubuser}" == "GameServerManager" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
else
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
fi
remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket"
local_filedir="${functionsdir}"
local_filename="${github_file_url_name}"
local_filename="${github_fileurl_name}"
chmodx="chmodx"
run="norun"
forcedl="noforce"

194
lgsm/functions/info_distro.sh

@ -10,19 +10,19 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
### Game Server pid
if [ "${status}" == "1" ]; then
gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $NF}')
gameserverpid="$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $NF}')"
if [ "${engine}" == "source" ]; then
srcdslinuxpid=$(ps -ef | grep -v grep | grep "${gameserverpid}" | grep srcds_linux | awk '{print $2}')
srcdslinuxpid="$(ps -ef | grep -v grep | grep "${gameserverpid}" | grep srcds_linux | awk '{print $2}')"
elif [ "${engine}" == "goldsrc" ]; then
hldslinuxpid=$(ps -ef | grep -v grep | grep "${gameserverpid}" | grep hlds_linux | awk '{print $2}')
hldslinuxpid="$(ps -ef | grep -v grep | grep "${gameserverpid}" | grep hlds_linux | awk '{print $2}')"
fi
fi
### Distro information
## Distro
# Returns architecture, kernel and distro/os.
arch=$(uname -m)
kernel=$(uname -r)
arch="$(uname -m)"
kernel="$(uname -r)"
# Distro Name - Ubuntu 16.04 LTS
# Distro Version - 16.04
@ -33,46 +33,49 @@ kernel=$(uname -r)
distro_info_array=( os-release lsb_release hostnamectl debian_version redhat-release )
for distro_info in "${distro_info_array[@]}"; do
if [ -f "/etc/os-release" ]&&[ "${distro_info}" == "os-release" ]; then
distroname=$(grep PRETTY_NAME /etc/os-release | sed 's/PRETTY_NAME=//g' | tr -d '="' | sed 's/\"//g')
distroversion=$(grep VERSION_ID /etc/os-release | sed 's/VERSION_ID=//g' | sed 's/\"//g')
distroid=$(grep ID /etc/os-release | grep -v _ID | grep -v ID_ | sed 's/ID=//g' | sed 's/\"//g')
distrocodename=$(grep VERSION_CODENAME /etc/os-release | sed 's/VERSION_CODENAME=//g' | sed 's/\"//g')
distroname="$(grep "PRETTY_NAME" /etc/os-release | awk -F\= '{gsub(/"/,"",$2);print $2}')"
distroversion="$(grep "VERSION_ID" /etc/os-release | awk -F\= '{gsub(/"/,"",$2);print $2}')"
# Special var for rhel like distros to removed point in number e.g 8.4 to just 8.
distroversionrh="$(printf "%.0f\n" "${distroversion}")"
distroid="$(grep "ID=" /etc/os-release | grep -v _ID | awk -F\= '{gsub(/"/,"",$2);print $2}')"
distroidlike="$(grep "ID_LIKE=" /etc/os-release | grep -v _ID | awk -F\= '{gsub(/"/,"",$2);print $2}')"
distrocodename="$(grep "VERSION_CODENAME" /etc/os-release | awk -F\= '{gsub(/"/,"",$2);print $2}')"
elif [ "$(command -v lsb_release 2>/dev/null)" ]&&[ "${distro_info}" == "lsb_release" ]; then
if [ -z "${distroname}" ];then
distroname=$(lsb_release -sd)
distroname="$(lsb_release -sd)"
elif [ -z "${distroversion}" ]; then
distroversion=$(lsb_release -sr)
distroversion="$(lsb_release -sr)"
elif [ -z "${distroid}" ]; then
distroid=$(lsb_release -si)
distroid="$(lsb_release -si)"
elif [ -z "${distrocodename}" ]; then
distrocodename=$(lsb_release -sc)
distrocodename="$(lsb_release -sc)"
fi
elif [ "$(command -v hostnamectl 2>/dev/null)" ]&&[ "${distro_info}" == "hostnamectl" ]; then
if [ -z "${distroname}" ];then
distroname=$(hostnamectl | grep "Operating System" | sed 's/Operating System: //g')
distroname="$(hostnamectl | grep "Operating System" | sed 's/Operating System: //g')"
fi
elif [ -f "/etc/debian_version" ]&&[ "${distro_info}" == "debian_version" ]; then
if [ -z "${distroname}" ]; then
distroname="Debian $(cat /etc/debian_version)"
elif [ -z "${distroversion}" ]; then
distroversion=$(cat /etc/debian_version)
distroversion="$(cat /etc/debian_version)"
elif [ -z "${distroid}" ]; then
distroid="debian"
fi
elif [ -f "/etc/redhat-release" ]&&[ "${distro_info}" == "redhat-release" ]; then
if [ -z "${distroname}" ]; then
distroname=$(cat /etc/redhat-release)
distroname="$(cat /etc/redhat-release)"
elif [ -z "${distroversion}" ]; then
distroversion=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos|fedora" | cut -d"-" -f3)
distroversion="$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos|fedora" | cut -d"-" -f3)"
elif [ -z "${distroid}" ]; then
distroid=$(awk '{print $1}' /etc/redhat-release)
distroid="$(awk '{print $1}' /etc/redhat-release)"
fi
fi
done
## Glibc version
# e.g: 1.17
glibcversion=$(ldd --version | sed -n '1s/.* //p')
glibcversion="$(ldd --version | sed -n '1s/.* //p')"
## tmux version
# e.g: tmux 1.6
@ -84,34 +87,38 @@ else
if [ "${tmuxvdigit}" -lt "16" ]; then
tmuxv="$(tmux -V) (>= 1.6 required for console log)"
else
tmuxv=$(tmux -V)
tmuxv="$(tmux -V)"
fi
fi
if [ "$(command -V java 2>/dev/null)" ]; then
javaversion=$(java -version 2>&1 | grep "version")
javaversion="$(java -version 2>&1 | grep "version")"
fi
if [ "$(command -v mono 2>/dev/null)" ]; then
monoversion="$(mono --version 2>&1 | grep -Po '(?<=version )\d')"
fi
## Uptime
uptime=$(</proc/uptime)
uptime="$(</proc/uptime)"
uptime=${uptime/[. ]*/}
minutes=$(( uptime/60%60 ))
hours=$(( uptime/60/60%24 ))
days=$(( uptime/60/60/24 ))
minutes="$(( uptime/60%60 ))"
hours="$(( uptime/60/60%24 ))"
days="$(( uptime/60/60/24 ))"
### Performance information
## Average server load
load=$(uptime|awk -F 'load average: ' '{ print $2 }')
load="$(uptime|awk -F 'load average: ' '{ print $2 }')"
## CPU information
cpumodel=$(awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')
cpucores=$(awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo)
cpufreqency=$(awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')
cpumodel="$(awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')"
cpucores="$(awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo)"
cpufreqency="$(awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')"
# CPU usage of the game server pid
if [ -n "${gameserverpid}" ]; then
cpuused=$(ps --forest -o pcpu -g "${gameserverpid}"|awk '{s+=$1} END {print s}')
cpuusedmhz=$(echo "${cpufreqency} * ${cpuused} / 100" | bc )
cpuused="$(ps --forest -o pcpu -g "${gameserverpid}"|awk '{s+=$1} END {print s}')"
cpuusedmhz="$(echo "${cpufreqency} * ${cpuused} / 100" | bc)"
fi
## Memory information
@ -122,86 +129,86 @@ if [ "$(command -v numfmt 2>/dev/null)" ]; then
# Issue #2005 - Kernel 3.14+ contains MemAvailable which should be used. All others will be calculated.
# get the raw KB values of these fields.
physmemtotalkb=$(grep MemTotal /proc/meminfo | awk '{print $2}')
physmemfreekb=$(grep ^MemFree /proc/meminfo | awk '{print $2}')
physmembufferskb=$(grep ^Buffers /proc/meminfo | awk '{print $2}')
physmemcachedkb=$(grep ^Cached /proc/meminfo | awk '{print $2}')
physmemreclaimablekb=$(grep ^SReclaimable /proc/meminfo | awk '{print $2}')
physmemtotalkb="$(grep MemTotal /proc/meminfo | awk '{print $2}')"
physmemfreekb="$(grep ^MemFree /proc/meminfo | awk '{print $2}')"
physmembufferskb="$(grep ^Buffers /proc/meminfo | awk '{print $2}')"
physmemcachedkb="$(grep ^Cached /proc/meminfo | awk '{print $2}')"
physmemreclaimablekb="$(grep ^SReclaimable /proc/meminfo | awk '{print $2}')"
# check if MemAvailable Exists.
if grep -q ^MemAvailable /proc/meminfo; then
physmemactualfreekb=$(grep ^MemAvailable /proc/meminfo | awk '{print $2}')
physmemactualfreekb="$(grep ^MemAvailable /proc/meminfo | awk '{print $2}')"
else
physmemactualfreekb=$((physmemfreekb+physmembufferskb+physmemcachedkb))
physmemactualfreekb="$((physmemfreekb+physmembufferskb+physmemcachedkb))"
fi
# Available RAM and swap.
physmemtotalmb=$((physmemtotalkb/1024))
physmemtotal=$(numfmt --to=iec --from=iec --suffix=B "${physmemtotalkb}K")
physmemfree=$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")
physmemused=$(numfmt --to=iec --from=iec --suffix=B "$((physmemtotalkb-physmemfreekb-physmembufferskb-physmemcachedkb-physmemreclaimablekb))K")
physmemavailable=$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")
physmemcached=$(numfmt --to=iec --from=iec --suffix=B "$((physmemcachedkb+physmemreclaimablekb))K")
swaptotal=$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapTotal /proc/meminfo | awk '{print $2}')K")
swapfree=$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapFree /proc/meminfo | awk '{print $2}')K")
swapused=$(numfmt --to=iec --from=iec --suffix=B "$(($(grep ^SwapTotal /proc/meminfo | awk '{print $2}')-$(grep ^SwapFree /proc/meminfo | awk '{print $2}')))K")
physmemtotalmb="$((physmemtotalkb/1024))"
physmemtotal="$(numfmt --to=iec --from=iec --suffix=B "${physmemtotalkb}K")"
physmemfree="$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")"
physmemused="$(numfmt --to=iec --from=iec --suffix=B "$((physmemtotalkb-physmemfreekb-physmembufferskb-physmemcachedkb-physmemreclaimablekb))K")"
physmemavailable="$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")"
physmemcached="$(numfmt --to=iec --from=iec --suffix=B "$((physmemcachedkb+physmemreclaimablekb))K")"
swaptotal="$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapTotal /proc/meminfo | awk '{print $2}')K")"
swapfree="$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapFree /proc/meminfo | awk '{print $2}')K")"
swapused="$(numfmt --to=iec --from=iec --suffix=B "$(($(grep ^SwapTotal /proc/meminfo | awk '{print $2}')-$(grep ^SwapFree /proc/meminfo | awk '{print $2}')))K")"
# RAM usage of the game server pid
# MB
if [ "${gameserverpid}" ]; then
memused=$(ps --forest -o rss -g "${gameserverpid}" | awk '{s+=$1} END {print s}'| awk '{$1/=1024;printf "%.0f",$1}{print $2}')
memused="$(ps --forest -o rss -g "${gameserverpid}" | awk '{s+=$1} END {print s}'| awk '{$1/=1024;printf "%.0f",$1}{print $2}')"
# %
pmemused=$(ps --forest -o %mem -g "${gameserverpid}" | awk '{s+=$1} END {print s}')
pmemused="$(ps --forest -o %mem -g "${gameserverpid}" | awk '{s+=$1} END {print s}')"
fi
else
# Older distros will need to use free.
# Older distros will need to use free.
# Older versions of free do not support -h option.
if [ "$(free -h > /dev/null 2>&1; echo $?)" -ne "0" ]; then
humanreadable="-m"
else
humanreadable="-h"
fi
physmemtotalmb=$(free -m | awk '/Mem:/ {print $2}')
physmemtotal=$(free ${humanreadable} | awk '/Mem:/ {print $2}')
physmemfree=$(free ${humanreadable} | awk '/Mem:/ {print $4}')
physmemused=$(free ${humanreadable} | awk '/Mem:/ {print $3}')
physmemtotalmb="$(free -m | awk '/Mem:/ {print $2}')"
physmemtotal="$(free ${humanreadable} | awk '/Mem:/ {print $2}')"
physmemfree="$(free ${humanreadable} | awk '/Mem:/ {print $4}')"
physmemused="$(free ${humanreadable} | awk '/Mem:/ {print $3}')"
oldfree=$(free ${humanreadable} | awk '/cache:/')
oldfree="$(free ${humanreadable} | awk '/cache:/')"
if [ "${oldfree}" ]; then
physmemavailable="n/a"
physmemcached="n/a"
else
physmemavailable=$(free ${humanreadable} | awk '/Mem:/ {print $7}')
physmemcached=$(free ${humanreadable} | awk '/Mem:/ {print $6}')
physmemavailable="$(free ${humanreadable} | awk '/Mem:/ {print $7}')"
physmemcached="$(free ${humanreadable} | awk '/Mem:/ {print $6}')"
fi
swaptotal=$(free ${humanreadable} | awk '/Swap:/ {print $2}')
swapused=$(free ${humanreadable} | awk '/Swap:/ {print $3}')
swapfree=$(free ${humanreadable} | awk '/Swap:/ {print $4}')
swaptotal="$(free ${humanreadable} | awk '/Swap:/ {print $2}')"
swapused="$(free ${humanreadable} | awk '/Swap:/ {print $3}')"
swapfree="$(free ${humanreadable} | awk '/Swap:/ {print $4}')"
fi
### Disk information
## Available disk space on the partition.
filesystem=$(LC_ALL=C df -hP "${rootdir}" | tail -n 1 | awk '{print $1}')
totalspace=$(LC_ALL=C df -hP "${rootdir}" | tail -n 1 | awk '{print $2}')
usedspace=$(LC_ALL=C df -hP "${rootdir}" | tail -n 1 | awk '{print $3}')
availspace=$(LC_ALL=C df -hP "${rootdir}" | tail -n 1 | awk '{print $4}')
filesystem="$(LC_ALL=C df -hP "${rootdir}" | tail -n 1 | awk '{print $1}')"
totalspace="$(LC_ALL=C df -hP "${rootdir}" | tail -n 1 | awk '{print $2}')"
usedspace="$(LC_ALL=C df -hP "${rootdir}" | tail -n 1 | awk '{print $3}')"
availspace="$(LC_ALL=C df -hP "${rootdir}" | tail -n 1 | awk '{print $4}')"
## LinuxGSM used space total.
rootdirdu=$(du -sh "${rootdir}" 2> /dev/null | awk '{print $1}')
rootdirdu="$(du -sh "${rootdir}" 2> /dev/null | awk '{print $1}')"
if [ -z "${rootdirdu}" ]; then
rootdirdu="0M"
fi
## LinuxGSM used space in serverfiles dir.
serverfilesdu=$(du -sh "${serverfiles}" 2> /dev/null | awk '{print $1}')
serverfilesdu="$(du -sh "${serverfiles}" 2> /dev/null | awk '{print $1}')"
if [ -z "${serverfilesdu}" ]; then
serverfilesdu="0M"
fi
## LinuxGSM used space total minus backup dir.
rootdirduexbackup=$(du -sh --exclude="${backupdir}" "${serverfiles}" 2> /dev/null | awk '{print $1}')
rootdirduexbackup="$(du -sh --exclude="${backupdir}" "${serverfiles}" 2> /dev/null | awk '{print $1}')"
if [ -z "${rootdirduexbackup}" ]; then
rootdirduexbackup="0M"
fi
@ -209,7 +216,7 @@ fi
## Backup info
if [ -d "${backupdir}" ]; then
# Used space in backups dir.
backupdirdu=$(du -sh "${backupdir}" | awk '{print $1}')
backupdirdu="$(du -sh "${backupdir}" | awk '{print $1}')"
# If no backup dir, size is 0M.
if [ -z "${backupdirdu}" ]; then
backupdirdu="0M"
@ -221,15 +228,15 @@ if [ -d "${backupdir}" ]; then
# If there are backups in backup dir.
if [ "$(find "${backupdir}" -name "*.tar.gz" | wc -l)" -ne "0" ]; then
# number of backups.
backupcount=$(find "${backupdir}"/*.tar.gz | wc -l)
backupcount="$(find "${backupdir}"/*.tar.gz | wc -l)"
# most recent backup.
lastbackup=$(ls -1t "${backupdir}"/*.tar.gz | head -1)
lastbackup="$(ls -1t "${backupdir}"/*.tar.gz | head -1)"
# date of most recent backup.
lastbackupdate=$(date -r "${lastbackup}")
lastbackupdate="$(date -r "${lastbackup}")"
# no of days since last backup.
lastbackupdaysago=$(( ( $(date +'%s') - $(date -r "${lastbackup}" +'%s') )/60/60/24 ))
lastbackupdaysago="$(( ( $(date +'%s') - $(date -r "${lastbackup}" +'%s') )/60/60/24 ))"
# size of most recent backup.
lastbackupsize=$(du -h "${lastbackup}" | awk '{print $1}')
lastbackupsize="$(du -h "${lastbackup}" | awk '{print $1}')"
fi
fi
@ -239,7 +246,7 @@ netlink=$(${ethtoolcommand} "${netint}" 2>/dev/null| grep Speed | awk '{print $2
# External IP address
if [ -z "${extip}" ]; then
extip=$(curl --connect-timeout 10 -s https://api.ipify.org 2>/dev/null)
extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2>/dev/null)"
exitcode=$?
# Should ifconfig.co return an error will use last known IP.
if [ ${exitcode} -eq 0 ]; then
@ -247,14 +254,14 @@ if [ -z "${extip}" ]; then
echo -e "${extip}" > "${tmpdir}/extip.txt"
else
if [ -f "${tmpdir}/extip.txt" ]; then
extip=$(cat "${tmpdir}/extip.txt")
extip="$(cat "${tmpdir}/extip.txt")"
else
fn_print_error_nl "Unable to get external IP"
fi
fi
else
if [ -f "${tmpdir}/extip.txt" ]; then
extip=$(cat "${tmpdir}/extip.txt")
extip="$(cat "${tmpdir}/extip.txt")"
else
fn_print_error_nl "Unable to get external IP"
fi
@ -271,26 +278,27 @@ else
fi
# Steam Master Server - checks if detected by master server.
if [ "$(command -v jq 2>/dev/null)" ]; then
if [ "${ip}" ]&&[ "${port}" ]; then
if [ "${steammaster}" == "true" ]||[ ${commandname} == "DEV-QUERY-RAW" ]; then
# Will query server IP addresses first.
for queryip in "${queryips[@]}"; do
masterserver="$(curl --connect-timeout 10 -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${queryip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l 2>/dev/null)"
done
# Should that not work it will try the external IP.
if [ "${masterserver}" == "0" ]; then
masterserver="$(curl --connect-timeout 10 -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l 2>/dev/null)"
fi
if [ "${masterserver}" == "0" ]; then
displaymasterserver="false"
else
displaymasterserver="true"
if [ -z "${displaymasterserver}" ]; then
if [ "$(command -v jq 2>/dev/null)" ]; then
if [ "${ip}" ]&&[ "${port}" ]; then
if [ "${steammaster}" == "true" ]||[ "${commandname}" == "DEV-QUERY-RAW" ]; then
# Will query server IP addresses first.
for queryip in "${queryips[@]}"; do
masterserver="$(curl --connect-timeout 10 -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${queryip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l 2>/dev/null)"
done
# Should that not work it will try the external IP.
if [ "${masterserver}" == "0" ]; then
masterserver="$(curl --connect-timeout 10 -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l 2>/dev/null)"
fi
if [ "${masterserver}" == "0" ]; then
displaymasterserver="false"
else
displaymasterserver="true"
fi
fi
fi
fi
fi
# Sets the SteamCMD glibc requirement if the game server requirement is less or not required.
if [ "${appid}" ]; then
if [ "${glibc}" = "null" ]||[ -z "${glibc}" ]||[ "$(printf '%s\n'${glibc}'\n' "2.14" | sort -V | head -n 1)" != "2.14" ]; then

21
lgsm/functions/info_game.sh

@ -2035,6 +2035,27 @@ fn_info_game_vh(){
servername=${servername:-"NOT SET"}
}
fn_info_game_vints(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
maxplayers="${unavailable}"
serverpassword="${unavailable}"
port="${unavailable}"
queryport="${unavailable}"
configip="${unavailable}"
else
servername=$(jq -r '.ServerName' "${servercfgfullpath}")
maxplayers=$(jq -r '.MaxClients' "${servercfgfullpath}")
serverpassword=$(jq -r 'select(.Password != null) | .Password' "${servercfgfullpath}")
port=$(jq -r '.Port' "${servercfgfullpath}")
queryport=${port:-"0"}
configip=$(jq -r 'select(.Ip != null) | .Ip' "${servercfgfullpath}")
serverpassword=${serverpassword:-"NOT SET"}
configip=${configip:-"0.0.0.0"}
fi
}
fn_info_game_wet(){
# Config
if [ ! -f "${servercfgfullpath}" ]; then

1
lgsm/functions/install_config.sh

@ -159,7 +159,6 @@ fn_list_config_locations(){
fi
echo -e "LinuxGSM Config: ${lgsmdir}/config-lgsm/${gameservername}"
echo -e "Documentation: https://docs.linuxgsm.com/configuration/game-server-config"
echo -e ""
}
if [ "${shortname}" == "sdtd" ]; then

1
lgsm/functions/install_server_dir.sh

@ -15,7 +15,6 @@ if [ -d "${serverfiles}" ]; then
fn_print_warning_nl "A server is already installed here."
fi
pwd
echo -e ""
if [ -z "${autoinstall}" ]; then
if ! fn_prompt_yn "Continue?" Y; then
exitcode=0

1
lgsm/functions/install_server_files.sh

@ -73,6 +73,7 @@ echo -e "================================="
fn_sleep_time
if [ "${appid}" ]; then
remotelocation="SteamCMD"
fn_dl_steamcmd
fi

Loading…
Cancel
Save