Advertisement
Guest User

samp_install.sh

a guest
Oct 17th, 2011
790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.92 KB | None | 0 0
  1. ###
  2. # By Rafael 'R@f' Keramidas
  3. ###
  4.  
  5. #!/bin/bash
  6.  
  7. # Command to get the download link for the sa-mp linux server archive (Lynx required !).
  8. LINK=`lynx -dump "http://files.sa-mp.com/?C=M;O=D" | awk '($2 ~ /\.tar\.gz/){print $2}' | head -1`
  9. # Get the archive name (by removing "http://files.sa-mp.com/".
  10. ANAME=`echo $LINK | sed 's/.\{23\}//'`
  11.  
  12. if [ -z $1 ]
  13. then
  14.     echo "USAGE: ./samp_install.sh [SERVERNAME]"
  15. else
  16.     echo "Starting install..."
  17.     # If the download directory does not exist.
  18.     if [ ! -d $DLDIR ]
  19.     then
  20.         # Create the download directory.
  21.         mkdir $DLDIR
  22.     fi
  23.     # Go to the download directory.
  24.     cd $DLDIR
  25.     # Download the archive.
  26.     wget $LINK
  27.     # Untar the archive.
  28.     tar -zxf $ANAME
  29.     # Removing the archive.
  30.     rm $ANAME
  31.     # Move and rename the samp directory
  32.     mv samp03 $1
  33.     # Go to the samp directory
  34.     cd $1
  35.     # Rename the server executable
  36.     mv samp03svr "samp03svr$1"
  37.     echo "Installation finished !"
  38. fi
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement