Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- TITLE="FunzAlot"
- LOGGEDIN=0
- systemCheck() {
- UNAME=`which uname`
- GREP=`which egrep`
- GREP_OPTIONS=""
- CUT=`which cut`
- READLINK=`which readlink`
- XARGS=`which xargs`
- DIRNAME=`which dirname`
- MKTEMP=`which mktemp`
- RM=`which rm`
- CAT=`which cat`
- SED=`which sed`
- if [ -z "$UNAME" -o -z "$GREP" -o -z "$CUT" -o -z "$MKTEMP" -o -z "$RM" -o -z "$CAT" -o -z "$SED" ]; then
- message "Required tools are missing - check beginning of \"$0\" file for details."
- exit 1
- fi
- }
- message() {
- if [ -n "`which zenity`" ]; then
- zenity --error --title="$TITLE" --text="$1"
- elif [ -n "`which kdialog`" ]; then
- kdialog --error "$1" --title "$TITLE"
- elif [ -n "`which xmessage`" ]; then
- xmessage -center "ERROR: $TITLE: $1"
- elif [ -n "`which notify-send`" ]; then
- notify-send "ERROR: $TITLE: $1"
- else
- printf "ERROR: $TITLE\n$1\n"
- fi
- }
- login() {
- ENTRY=`zenity --password --username`
- case $? in
- 0)
- UN="`echo $ENTRY | cut -d'|' -f1`"
- PW="`echo $ENTRY | cut -d'|' -f2`"
- if [ $UN == "jessica" ] && [ $PW == "Testing123" ]; then
- LOGGEDIN=1
- return
- else
- LOGGEDIN=0
- zenity --notification --window-icon="warning" --text="The username and password are incorrect"
- fi
- ;;
- 1)
- message "Stop login."
- exit 0
- ;;
- -1)
- message "An unexpected error has occurred."
- exit 1
- ;;
- esac
- }
- main() {
- while [ $LOGGEDIN -ne 1 ]; do
- login
- done
- }
- main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement