Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let dependencies = [
- 'mailutils',
- 'postfix',
- 'curl',
- 'wget',
- 'file',
- 'bzip2',
- 'gzip',
- 'unzip',
- 'bsdmainutils',
- 'python',
- 'util-linux',
- 'ca-certificates',
- 'binutils',
- 'bc',
- 'jq',
- 'tmux',
- 'lib32gcc1',
- 'libstdc++6',
- 'libstdc++6:i386'
- ];
- ssh.connect({
- host : server.main_ip,
- username : 'root',
- password : server.default_password
- })
- .then(() => {
- ssh.execCommand('useradd -u 12345 -g users -d /home/'+game_dir_name+' -s /bin/bash -p $(echo '+user_password+' | openssl passwd -1 -stdin) '+game_dir_name)
- .then(userCreated => {
- console.log('[USER CREATED]', userCreated);
- ssh.execCommand('mkdir /home/'+game_dir_name)
- .then(userFolderCreated => {
- console.log('[USER FOLDER CREATED]', userFolderCreated);
- ssh.exec('apt-get update')
- .then(updated => {
- console.log('[SYSTEM UPDATED]', updated);
- ssh.exec('apt-get upgrade', ['-y'])
- .then(upgraded => {
- console.log('[SYSTEM UPGRADED]', upgraded);
- ssh.exec('apt-get install ' + dependencies.join(' '), ['-y'])
- .then(dependencies => {
- console.log('[DEPENDENCIES INSTALLED]', dependencies);
- ssh.execCommand('wget -O linuxgsm.sh https://linuxgsm.sh', { cwd:'/home/' + game_dir_name })
- .then(downloaded =>{
- console.log('[DOWNLOADED MANAGER]', downloaded);
- ssh.execCommand('chmod +x /home/'+game_dir_name+'/linuxgsm.sh').then(chmoded => {
- console.log('[MANAGER CHMODED]', chmoded);
- ssh.execCommand('chown -R '+game_dir_name+':12345 /home/'+game_dir_name).then(chown => {
- console.log('[CHANGED PERMISSIONS]', chown);
- sshUser.connect({
- host : server.main_ip,
- username : game_dir_name,
- password : user_password
- }).then(() => {
- sshUser.execCommand('bash /home/'+game_dir_name+'/linuxgsm.sh csgoserver').then(installer => {
- console.log('[INSTALLER CREATED]', installer);
- sshUser.execCommand('bash /home/'+game_dir_name+'/csgoserver install').then(installed => {
- console.log('[INSTALLED GAME SERVER]', installed);
- }).catch(error => console.log(error));
- }).catch(error => console.log(error));
- }).catch(error => console.log(error));
- }).catch(error => console.log(error));
- }).catch(error => console.log(error));
- }).catch(error => console.log(error));
- }).catch(error => console.log(error))
- }).catch(error => console.log(error))
- }).catch(error => console.log(error))
- }).catch(error => console.log(error))
- }).catch(error => console.log(error));
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement