Keresés

Új hozzászólás Aktív témák

  • kkd

    tag

    válasz fuximaxi #305 üzenetére

    #!/bin/sh
    # filename: mcommander.sh
    # author: Dan Merschi
    # date: 2009-07-28 ; Add multiplatform support
    # author: Graham Inggs <graham@nerve.org.za>
    # date: 2012-04-11 ; Updated for NAS4Free 9.0.0.1
    # date: 2013-02-09 ; Updated for ftp.freebsd.org restructuring and latest mc-light version
    # purpose: Install Midnight Commander Light on NAS4Free(embedded version).
    # Note: Check the end of the page.
    #
    #----------------------- Set variables ------------------------------------------------------------------
    DIR=`dirname $0`;
    PLATFORM=`uname -m`
    RELEASE=`uname -r | cut -d- -f1`
    URL="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${PLATFORM}/packages-9-current/All"
    MCLIGHTFILE="mc-light-4.1.40.p9_9.tbz"
    COMPAT7XFILE="compat7x-${PLATFORM}-7.3.703000.201008_1.tbz"
    #----------------------- Set Errors ---------------------------------------------------------------------
    _msg() { case $@ in
    0) echo "The script will exit now."; exit 0 ;;
    1) echo "No route to server, or file do not exist on server"; _msg 0 ;;
    2) echo "Can't find ${FILE} on ${DIR}"; _msg 0 ;;
    3) echo "MC Light installed and ready! (ONLY USE DURING A SSH SESSION)"; exit 0 ;;
    4) echo "Always run this script using the full path: /mnt/.../directory/mcommander.sh"; _msg 0 ;;
    esac ; exit 0; }
    #----------------------- Check for full path ------------------------------------------------------------
    if [ ! `echo $0 |cut -c1-5` = "/mnt/" ]; then _msg 4 ; fi
    cd $DIR;
    #----------------------- Download and decompress mc-light files if don't exist --------------------------
    FILE=${MCLIGHTFILE}
    if [ ! -d ${DIR}/bin ]; then
    if [ ! -e ${DIR}/${FILE} ]; then fetch ${URL}/${FILE} || _msg 1; fi
    if [ -f ${DIR}/${FILE} ]; then tar xzf ${DIR}/${FILE} || _msg 2; rm ${DIR}/+*; rm -R ${DIR}/man; fi
    if [ ! -d ${DIR}/bin ]; then _msg 4; fi
    fi
    #----------------------- Download and decompress compat7x files if don't exist --------------------------
    FILE=${COMPAT7XFILE}
    if [ ! -d ${DIR}/lib ]; then
    if [ ! -e ${DIR}/${FILE} ]; then fetch ${URL}/${FILE} || _msg 1; fi
    if [ -f ${DIR}/${FILE} ]; then tar xzf ${DIR}/${FILE} || _msg 2}; rm ${DIR}/+*; rm -R ${DIR}/libdata; fi
    if [ -d ${DIR}/lib32 ]; then rm -R ${DIR}/lib32; fi
    if [ ! -d ${DIR}/lib ]; then _msg 4; fi
    fi
    #----------------------- If don't exist, creat root directory and root files ----------------------------
    if [ ! -d ${DIR}/root ]; then mkdir $DIR/root && cd $DIR/root && touch edit.pos history hotlist ini; fi
    #----------------------- Create symlinks ----------------------------------------------------------------
    if [ ! -e /usr/local/share/mc ]; then ln -s ${DIR}/share/mc /usr/local/share; fi
    if [ ! -d /root/.mc/cedit ]; then mkdir -p /root/.mc/cedit; fi
    for i in `ls $DIR/bin/`
    do if [ ! -f /usr/bin/${i} ]; then ln -s ${DIR}/bin/$i /usr/bin; fi; done
    for i in `ls $DIR/share/mc/syntax/`
    do if [ ! -e /root/.mc/cedit/${i} ]; then ln -s $DIR/share/mc/syntax/${i} /root/.mc/cedit/; fi; done
    for i in `ls $DIR/root`
    do if [ ! -f /root/.mc/${i} ]; then ln -s $DIR/root/$i /root/.mc/; fi; done
    ln -s ${DIR}/lib/compat /usr/local/lib
    /sbin/ldconfig -m /usr/local/lib/compat
    _msg 3 ; exit 0;
    #----------------------- End of Script ------------------------------------------------------------------
    # 1. Keep this script in his own directory.
    # 2. chmod the script u+x,
    # 3. Always run this script using the full path: /mnt/share/directory/mcommander
    # 4. You can add this script to WebGUI: Advanced: Commands as Post command (see 3).
    # 5. To run Midnight Commander Light from shell type 'mc'.

    lehet 10-esen nem megy...

    [ Szerkesztve ]

Új hozzászólás Aktív témák