SF logo

(Ésta no es más que una versión en desarrollo como ejemplo de en qué estamos trabajando y cómo lo estamos haciendo que no necesariamente concordará de forma exacta con el código de la versión publicada en cada release del programa)

#!/bin/bash

echo "WARNING!

This can be a HIGHLY UNSECURE SCRIPT if you're not sure what you're doing.
If you continue, this will follow the next steps:
 1 - Check the following dependencies and apt-get install them:
     .- Dialog
     .- Xdialog (optional, will be asked)
     .- Macchanger (optional, will be asked)
     .- wireless-tools
 2 - Copy oswax to /usr/bin/oswax
 3 - Make it executable: # chmod ugo+x
 4 - Give to a user you will choose permissions for executing oswax as sudo WITHOUT asking for password.

Are you sure you want to continue? (Y/N)"
read -n 1 CONTINUE
if [ "$CONTINUE" == "Y" ]
 then
 if [ "$(whoami)" == "root" ]
  then
  echo

  echo "Install Xdialog? (Y/N)"

  read -n 1 XDIA
  if [ "$XDIA" == "Y" ]
    then
    ADDXDIA=" xdialog "
  else
    ADDXDIA=""
  fi
  echo

  echo "Install Macchanger? (Y/N)"

  read -n 1 MCC
  if [ "$MCC" == "Y" ]
    then
    ADDMCC=" macchanger "
  else
    ADDMCC=""
  fi
  echo
  echo
  echo "Let's check dependencies and install them if necessary."
  echo

  if apt-get install dialog wireless-tools $ADDMCC $ADDXDIA

    then
    echo
    echo
    echo "Dependencies checked/installed OK"
      echo
    echo
    echo "Let's copy oswax executable to /usr/bin "
    echo    

    cp oswax /usr/bin/oswax

    chmod ugo+x /usr/bin/oswax

    echo
    echo
    echo "Let's give sudo permissions to your user"
    echo
    CONTROL="N"
    
    while [ "$CONTROL" != "Y" ]
    do

        echo "Write the username who will run OSWAX:"

        read USERNAME
        echo
        echo "$USERNAME will run OSWAX throught sudo. OK? (Y/N)"
        read -n 1 CONTROL  
        echo
    done
    
    if [ "$CONTROL" == "Y" ]
    then

        if [ "$(cat /etc/sudoers | grep "oswax")" != "" ]

            then
            echo
            echo "$USERNAME seems to have something defined in sudoers about oswax: "
            echo
            cat /etc/sudoers | grep "oswax"
            echo
            echo "This installator won't overwrite anything. Edit it manually if necessary."
        else
                   echo " # BEGIN OF LINES ADDED BY OSWAX INSTALLATOR " >> /etc/sudoers

            echo "$USERNAME  ALL= NOPASSWD: /usr/bin/oswax" >> /etc/sudoers

            echo " # END OF LINES ADDED BY OSWAX INSTALLATOR " >> /etc/sudoers
        fi
fi
  else
    echo
    echo
    echo "Some error happened while checking dependencies"
  fi
 
 fi
fi

Generated by SimpleDoc on 2006-02-14 21:27:36 GMT+01:00