Advertisement
Guest User

Untitled

a guest
Aug 8th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                 let dependencies = [
  2.                     'mailutils',
  3.                     'postfix',
  4.                     'curl',
  5.                     'wget',
  6.                     'file',
  7.                     'bzip2',
  8.                     'gzip',
  9.                     'unzip',
  10.                     'bsdmainutils',
  11.                     'python',
  12.                     'util-linux',
  13.                     'ca-certificates',
  14.                     'binutils',
  15.                     'bc',
  16.                     'jq',
  17.                     'tmux',
  18.                     'lib32gcc1',
  19.                     'libstdc++6',
  20.                     'libstdc++6:i386'
  21.                 ];
  22.                 ssh.connect({
  23.                     host     : server.main_ip,
  24.                     username : 'root',
  25.                     password : server.default_password
  26.                 })
  27.                 .then(() => {
  28.                     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)
  29.                     .then(userCreated => {
  30.                         console.log('[USER CREATED]', userCreated);
  31.                         ssh.execCommand('mkdir /home/'+game_dir_name)
  32.                         .then(userFolderCreated => {
  33.                             console.log('[USER FOLDER CREATED]', userFolderCreated);
  34.                             ssh.exec('apt-get update')
  35.                             .then(updated => {
  36.                                 console.log('[SYSTEM UPDATED]', updated);
  37.                                 ssh.exec('apt-get upgrade', ['-y'])
  38.                                 .then(upgraded => {
  39.                                     console.log('[SYSTEM UPGRADED]', upgraded);
  40.                                     ssh.exec('apt-get install ' + dependencies.join(' '), ['-y'])
  41.                                     .then(dependencies => {
  42.                                         console.log('[DEPENDENCIES INSTALLED]', dependencies);
  43.                                         ssh.execCommand('wget -O linuxgsm.sh https://linuxgsm.sh', { cwd:'/home/' + game_dir_name })
  44.                                         .then(downloaded =>{
  45.                                             console.log('[DOWNLOADED MANAGER]', downloaded);
  46.                                             ssh.execCommand('chmod +x /home/'+game_dir_name+'/linuxgsm.sh').then(chmoded => {
  47.                                                 console.log('[MANAGER CHMODED]', chmoded);
  48.                                                 ssh.execCommand('chown -R '+game_dir_name+':12345 /home/'+game_dir_name).then(chown => {
  49.                                                     console.log('[CHANGED PERMISSIONS]', chown);
  50.                            
  51.                                                     sshUser.connect({
  52.                                                         host     : server.main_ip,
  53.                                                         username : game_dir_name,
  54.                                                         password : user_password
  55.                                                     }).then(() => {
  56.                                                         sshUser.execCommand('bash /home/'+game_dir_name+'/linuxgsm.sh csgoserver').then(installer => {
  57.                                                             console.log('[INSTALLER CREATED]', installer);
  58.                                                             sshUser.execCommand('bash /home/'+game_dir_name+'/csgoserver install').then(installed => {
  59.                                                                 console.log('[INSTALLED GAME SERVER]', installed);
  60.                                                             }).catch(error => console.log(error));
  61.                                                         }).catch(error => console.log(error));
  62.                                                     }).catch(error => console.log(error));
  63.                                                 }).catch(error => console.log(error));
  64.                                             }).catch(error => console.log(error));
  65.                                         }).catch(error => console.log(error));
  66.                                     }).catch(error => console.log(error))
  67.                                 }).catch(error => console.log(error))
  68.                             }).catch(error => console.log(error))
  69.                         }).catch(error => console.log(error))
  70.                     }).catch(error => console.log(error));
  71.                 })
  72.             })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement