Tiny Core Base > Raspberry Pi

Please help a beginner

<< < (2/5) > >>

bmarkus:

--- Quote from: sbp on January 13, 2013, 12:10:57 PM ---
2. Does anybody know which USB  wifi dongle would be easiest to use in the piCore image?


--- End quote ---

Good starting point:

http://elinux.org/RPi_VerifiedPeripherals#USB_Wi-Fi_Adapters

sbp:

--- Quote from: bmarkus on January 13, 2013, 02:25:40 PM ---
--- Quote from: sbp on January 13, 2013, 12:10:57 PM ---
2. Does anybody know which USB  wifi dongle would be easiest to use in the piCore image?


--- End quote ---

Good starting point:

http://elinux.org/RPi_VerifiedPeripherals#USB_Wi-Fi_Adapters

--- End quote ---

Thanks I will find one from the list.


Two new questions/problems:

1
I have been trying to make a small script - let us call it test, which I want to be able to run when I write test in a terminal.
Therefore I used:
sudo vi test

In the test file I added these lines:
#!/bin/bash
clear
echo "Good morning, world."

Saved the file test
Then:
sudo chmod -R 755 test

BUT I cant make it run. Trying with:
./test     results in
sh: ./test not found

But the command: 
ls           returns
sbp       (in green)

So it seems I lack some fundamental understanding here.


2.
Another question is (when I manage to make a working script). where should I put this script, so that I can run it via putty in a terminal? Should I put it in init.d directory, or where is the best place?

Steen     

bmarkus:
Steen

1) By default piCore shipped with ash shell implemented as a BusyBox applet. It is similar to bash, but smaller and a bit different operation. Replace first line of the script with

#!/bin/sh

In most cases you do not need bash. If you write your own script, avoid using bash specific features. If you (or an application) really need it, install from the repo.

2) Put it to /usr/local/bin or /usr/local/sbin These locations are in the path so they will be executed. Don't forget to make them executable. If you want to make them persistent, add them to the backup or make your own .tcz extension.


sbp:
Hi bmarcus.

Thanks for the help.
Now I can run a script. I have been trying to make a script which will allow the user to put in the correct start up sentence for the Squeezetite player (it will depend on the kind of USB DAC used)

This is the script:

#!/bin/sh
clear
# here the user input the string
echo -e "Hi, please write the squeezelite commands you would like to use for starting Squeezelite"
read START_STRING
echo "$START_STRING - Will be written to /opt/bootlocal.sh."
read -p "Is it correct (y/n)?"
[ "$REPLY" = "y" ] || sudo echo "START_STRING" >> /opt/bootlocal.sh


# here the changes are made persistent
echo -e "Now these changes will be saved"
filetool.sh -b
echo -e " "
echo -e "If you will use an external USB DAC please insert now"


# here it ask for a reboot
read -p "To use the new settings you should reboot now (Y/N)?"
[ "$REPLY" = "y" ] || sudo reboot



My problems are:
1. START_STRING is added to the bootlocal.sh instead of the actual string given by the user.

2. the y/n option in the script seems to not discriminate between a "y" or a "n" press.

3. what I really would like the script to do is to find this line in bootlocal.sh:
sudo /mnt/mmcblk0p2/tce/squeezelite-armv6hf -n piCoPlayer -m 00:11:95:00:54:01 -
and exchange it with the string given by the user from the first part of my script
so that it does not simply add a new line to the bootlocal.sh file
Will that be possible?

4. After I have made the script file /usr/local/sbin/setup-audio  and used:     filetool.sh -b   this script file is not present after a reboot

After running the script the resulting bootlocal.sh file:

# put other system startup commands here
usr/local/etc/init.d/dropbear start
sudo /mnt/mmcblk0p2/tce/squeezelite-armv6hf -n piCoPlayer -m 00:11:95:00:54:01 -
amixer set PCM 400 unmute
START_STRING

Rich:
Hi sbp

--- Quote ---1. START_STRING is added to the bootlocal.sh instead of the actual string given by the user.
--- End quote ---
Try    $START_STRING

--- Code: ---echo "$START_STRING" >> /opt/bootlocal.sh
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version