[BACK]Return to installer.sh CVS log [TXT][DIR] Up to [local] / mtctl

Annotation of mtctl/installer.sh, Revision 1.2

1.1       bountyht    1: OS="`uname`"
                      2: ROOTCMD='sudo'
                      3: case $OS in
                      4:        'Linux')
                      5:                SHLL='bash'
                      6:                ;;
                      7:        'FreeBSD')
                      8:                SHLL='sh'
                      9:                ;;
                     10:        'OpenBSD')
                     11:                SHLL='ksh'
                     12:                ROOTCMD='doas'
                     13:                ;;
                     14:        *)
                     15:                exit
                     16:                ;;
                     17: esac
                     18:
                     19: if [[ "`id -u`" -eq 0 ]]; then
                     20:        echo -e "Checking Root User(Oke)"
                     21: else
                     22:        echo -e "Checking Root User(Failed). Switching to root user"
                     23:        PROFILE_SHELL=`sh -c 'ps -p $$ -o ppid=' | xargs ps -o comm= -p`
                     24:
                     25:        if [ "$PROFILE_SHELL" \!= "$SHLL" ]; then
1.2     ! bountyht   26:                exec curl -sSL https://ircforever.org/mtctl.php | $ROOTCMD $SHLL "$@"
1.1       bountyht   27:        else
                     28:                exec $ROOTCMD $SHLL "$0" "$@"
                     29:        fi
                     30:        exit $?
                     31: fi
                     32:
                     33: echo -e "\nmtctl Installer, Starting up..."
                     34: SHaLL="`which $SHLL`"
                     35:
                     36: if [ \! -f mtctl_default.sh ]; then wget -O mtctl_default.sh "https://cvsweb.planetofnix.com/cgi-bin/cvsweb/~checkout~/mtctl/mtctl_default.sh?content-type=text/plain"; fi
                     37:
1.2     ! bountyht   38: VARS="#!$SHaLL\n"
1.1       bountyht   39: echo -e "$VARS" > mtctl
                     40: cat mtctl_default.sh >> mtctl
                     41:
                     42: chmod 555 mtctl
                     43: $ROOTCMD install mtctl /usr/bin/mtctl
1.2     ! bountyht   44: $ROOTCMD mkdir -p /etc/mtctl
1.1       bountyht   45:
                     46: if [ "$SHLL" == "bash" ]; then
                     47:        if [ \! -f mtctl-completion.bash ]; then wget -O mtctl-completion.bash "https://cvsweb.planetofnix.com/cgi-bin/cvsweb/~checkout~/mtctl/mtctl-completion.bash?content-type=text/plain"; fi
                     48:        MTDIR="$MTLOCATION/worlds"; MTDIR=${MTDIR//\//\\\/}
                     49:        cat mtctl-completion.bash  | sed -e "s/{WORLDFOLDER}/$MTDIR/" > tmpfile.txt; mv tmpfile.txt mtctl-completion.bash
                     50:        $ROOTCMD grep -q "mtctl" /usr/share/bash-completion/bash_completion; [ $? -eq 0 ] || \
                     51:                $ROOTCMD cat /usr/share/bash-completion/bash_completion >> mtctl-completion.bash && $ROOTCMD mv mtctl-completion.bash /usr/share/bash-completion/bash_completion
                     52: fi
                     53:
                     54: echo -e "Done!\n\nThanks for installing mtctl!\nYou can now use it by running $ mtctl"

CVSweb