View Single Post
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#140
Hi Almehdin
Can you help me please.. I tried to add Adhoc at startup to my script. I edited a little you commands, but this not work..
This is your bkock:

Code:
    # Add adhoc at startup
    [Aa][Hh] )

        echo ""
        echo "This will add adhoc at startup"
        echo ""

    read -p "Enter A to activate/install, D to deactivate
or R to remove: " ADR
        echo ""
    read -p "Password: " -s PASSWORD
        case $ADR in
            [Aa] ) echo $PASSWORD | devel-su -c "echo '# Description of the script, mandatory
            description \"Allow Adhoc script\"

            # Author e-mail address, mandatory
            author \"salyavin@gokuraku.fcac.com\"

            # stop when xsession is stopped
            stop on stopping xsession

            # stdout to /dev/null, use \"console output\" to direct stdout to console (optional)
            console none

            # Start myapp as user
            exec /bin/echo 1 > /sys/devices/platform/wl1271/allow_adhoc' > /etc/init/apps/adhoc.conf" >/dev/null 
            ;;
            [Dd] ) echo $PASSWORD | devel-su -c "echo '# Description of the script, mandatory
            description \"Allow Adhoc script\"

            # Author e-mail address, mandatory
            author \"salyavin@gokuraku.fcac.com\"

            # stop when xsession is stopped
            stop on stopping xsession

            # stdout to /dev/null, use \"console output\" to direct stdout to console (optional)
            console none

            # Start myapp as user
            exec /bin/echo 0 > /sys/devices/platform/wl1271/allow_adhoc' > /etc/init/apps/adhoc.conf" >/dev/null
            ;;
            [Rr] ) echo $PASSWORD | devel-su -c 'rm /etc/init/apps/adhoc.conf'
            ;;            
        esac
        read -p "Done! Your change will be enabled after next reboot." end
    ;;
And this what I edited:

Code:
    [cC][cC] )
        echo "This will add adhoc at startup"
        echo ""
        echo "1. Activate"
        echo "2. Deactivate"
        echo "3. Remove"
        echo ""

       read -p "Choose from 1 to 3: " ANS
        echo ""
        case $ANS in
            1 ) echo '# Description of the script, mandatory
description "Allow Adhoc script"

# Author e-mail address, mandatory
author "salyavin@gokuraku.fcac.com"

# stop when xsession is stopped
stop on stopping xsession

# stdout to /dev/null, use "console output" to direct stdout to console (optional)
console none

# Start myapp as user
exec /bin/echo 1 > /sys/devices/platform/wl1271/allow_adhoc' > /etc/init/apps/adhoc.conf
/bin/echo 1 >/dev/null
;;
            2 ) echo '# Description of the script, mandatory
description "Allow Adhoc script"

# Author e-mail address, mandatory
author "salyavin@gokuraku.fcac.com"

# stop when xsession is stopped
stop on stopping xsession

# stdout to /dev/null, use "console output" to direct stdout to console (optional)
console none

# Start myapp as user
exec /bin/echo 0 > /sys/devices/platform/wl1271/allow_adhoc' > /etc/init/apps/adhoc.conf
/bin/echo 0 >/dev/null
;;
            3 ) rm /etc/init/apps/adhoc.conf ;;
            * ) read -p "Just answer from 1 to 3. Aborting!" end; continue ;;
        esac
      echo "Your changes will take effect after Reboot. You want to reboot now ?"
      echo " "
    read -p "Choose Y or N: " inputline
       echo " "

   for carattere in $inputline; do
    case $carattere in
        [Yy] ) echo "Your phone will reboot now!"
               echo " "
               sleep 2 && /sbin/reboot ;;

          [Nn] ) echo "You chose to NOT reboot."
                echo " "
  esac
 done;;

Both of them create a same file adhoc.conf in /etc/init/apps, but one guy who tested my version, said me this does not work.. I don't know why...
Thanks