Merge branch 'master' of https://git.donaldburr.com/dburr/raspberrypi
This commit is contained in:
commit
670252ac60
7 changed files with 126 additions and 42 deletions
|
@ -20,7 +20,6 @@ for DIR in *; do
|
|||
fi
|
||||
cd "$DIR"
|
||||
echo "working in $DIR"
|
||||
cd ..
|
||||
for INFILE in *.raw; do
|
||||
echo "working on $INFILE"
|
||||
FIX="`echo $INFILE | sed -e 's/^\[.*\] //g'`"
|
||||
|
@ -29,28 +28,27 @@ for DIR in *; do
|
|||
echo "...converting to intermediate format $TEMP_OUTFILE"
|
||||
#sox -r 44100 -e unsigned -b 8 -c 1 <RAW_FILE> <TARGET_FILE>
|
||||
sox -r 22050 -e signed -b 16 -L -c 1 "$INFILE" "$TEMP_OUTFILE"
|
||||
echo "...converting it to FLAC"
|
||||
if [ -f "$FLAC_DIR/$BASENAME.flac" -o "$MP3_DIR/$BASENAME.mp3" ] ; then
|
||||
if [ -f "$FLAC_DIR/$DIR/$BASENAME.flac" -o -f "$MP3_DIR/$DIR/$BASENAME.mp3" ] ; then
|
||||
FUDGE="$RANDOM"
|
||||
FLAC_FILE="$FLAC_DIR/$BASENAME-$FUDGE.flac"
|
||||
MP3_FILE="$FLAC_DIR/$BASENAME-$FUDGE.mp3"
|
||||
FLAC_FILE="$FLAC_DIR/$DIR/$BASENAME-$FUDGE.flac"
|
||||
MP3_FILE="$MP3_DIR/$DIR/$BASENAME-$FUDGE.mp3"
|
||||
else
|
||||
FLAC_FILE="$FLAC_DIR/$BASENAME.flac"
|
||||
MP3_FILE="$FLAC_DIR/$BASENAME.mp3"
|
||||
FLAC_FILE="$FLAC_DIR/$DIR/$BASENAME.flac"
|
||||
MP3_FILE="$MP3_DIR/$DIR/$BASENAME.mp3"
|
||||
fi
|
||||
if [ ! -f "$FLAC_FILE" ]; then
|
||||
echo "...converting it to FLAC: $FLAC_FILE"
|
||||
flac -8 "$TEMP_OUTFILE" "$FLAC_FILE"
|
||||
flac -s -8 "$TEMP_OUTFILE" -o "$FLAC_FILE"
|
||||
else
|
||||
echo "...already converted"
|
||||
fi
|
||||
if [ ! -f "$MP3_FILE" ]; then
|
||||
echo "...converting it to MP3: $MP3_FILE"
|
||||
lame --preset studio "$TEMP_OUTFILE" "$MP3_FILE"
|
||||
lame --quiet --preset studio "$TEMP_OUTFILE" "$MP3_FILE"
|
||||
else
|
||||
echo "...already converted"
|
||||
fi
|
||||
rm -f "$TEMP_OUTFILE"
|
||||
#rm -f "$TEMP_OUTFILE"
|
||||
done
|
||||
cd ..
|
||||
done
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ ! -z "$FLAC_LEVEL" ]; then
|
||||
LEVEL="-$FLAC_LEVEL"
|
||||
else
|
||||
LEVEL="-8"
|
||||
fi
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
FLACNAME="`basename \"$1\" .wav`.flac"
|
||||
flac $LEVEL "$1" "$FLACNAME"
|
||||
else
|
||||
for F in *.wav; do
|
||||
FLACNAME="`basename \"$F\" .wav`.flac"
|
||||
flac $LEVEL "$F" "$FLACNAME"
|
||||
done
|
||||
fi
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
if [ ! -z "$LAME_PRESET" ]; then
|
||||
PRESET="$LAME_PRESET"
|
||||
else
|
||||
PRESET="studio"
|
||||
fi
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
MP3NAME="`basename \"$1\" .wav`.mp3"
|
||||
lame --preset $PRESET "$1" "$MP3NAME"
|
||||
else
|
||||
for F in *.wav; do
|
||||
MP3NAME="`basename \"$F\" .wav`.mp3"
|
||||
lame --preset $PRESET "$F" "$MP3NAME"
|
||||
done
|
||||
fi
|
26
auto_raspbian/auto_raspbian
Executable file
26
auto_raspbian/auto_raspbian
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/python
|
||||
#http://raspberrypi.stackexchange.com/questions/15192/installing-raspbian-from-noobs-without-display
|
||||
#also: https://github.com/shamiao/TRUNCATED-raspi-autoconfig
|
||||
|
||||
import json
|
||||
|
||||
f = open('test.json', 'r')
|
||||
data = json.load(f)
|
||||
new_dict = {}
|
||||
the_stuff = []
|
||||
|
||||
if data["flavours"]:
|
||||
print "found flavours"
|
||||
flavours = data["flavours"]
|
||||
for flavour in flavours:
|
||||
print "found flavour [%s]" % flavour["name"]
|
||||
if flavour["name"].lower() == "raspbian":
|
||||
print "found raspbian"
|
||||
the_stuff.append(flavour)
|
||||
|
||||
new_dict["flavours"] = the_stuff
|
||||
|
||||
print new_dict
|
||||
outfile = open('new_test.json', 'w')
|
||||
json.dump(new_dict, outfile)
|
||||
|
1
auto_raspbian/new_test.json
Normal file
1
auto_raspbian/new_test.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"flavours": [{"supported_hex_revisions": "2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,1040,1041", "name": "Raspbian", "description": "A Debian wheezy port, optimised for the Raspberry Pi"}]}
|
14
auto_raspbian/test.json
Executable file
14
auto_raspbian/test.json
Executable file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"flavours": [
|
||||
{
|
||||
"name": "Raspbian - Boot to Scratch",
|
||||
"description": "A version of Raspbian that boots straight into Scratch",
|
||||
"supported_hex_revisions": "2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,1040,1041"
|
||||
},
|
||||
{
|
||||
"name": "Raspbian",
|
||||
"description": "A Debian wheezy port, optimised for the Raspberry Pi",
|
||||
"supported_hex_revisions": "2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,1040,1041"
|
||||
}
|
||||
]
|
||||
}
|
77
tools/pi_sd_prep.sh
Executable file
77
tools/pi_sd_prep.sh
Executable file
|
@ -0,0 +1,77 @@
|
|||
#!/bin/bash
|
||||
|
||||
# cleanup
|
||||
# trap ctrl-c and call ctrl_c()
|
||||
trap cleanup INT
|
||||
|
||||
function cleanup() {
|
||||
rm -f /tmp/noobs.zip
|
||||
umount -f /tmp/sdcard.$$ >/dev/null 2>&1
|
||||
rmdir /tmp/sdcard.$$
|
||||
echo "Aborted."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "ERROR: this script must be run as root (i.e. using \`sudo'.)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PATH=${PATH}:/sbin:/usr/sbin
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "USAGE: pi_sd_prep.sh device"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -b "$1" ]; then
|
||||
echo "ERROR: no such device: $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEV="$1"
|
||||
|
||||
echo "Unmoounting all partitions on $DEV:"
|
||||
PARTS="`df | grep ^$DEV | awk '{ print $1 }'`"
|
||||
if [ ! -z "$PARTS" ]; then
|
||||
for PART in $PARTS; do
|
||||
echo "...$PART"
|
||||
umount "$PART"
|
||||
done
|
||||
fi
|
||||
echo "...done"
|
||||
|
||||
echo "Preparing partition table on $DEV:"
|
||||
dd if=/dev/zero of=/dev/sdb bs=512 count=10 >/dev/null 2>&1
|
||||
echo -e "n\np\n1\n\n\nt\nb\na\n1\nw\nq\n" | fdisk $DEV >/dev/null
|
||||
echo "...done"
|
||||
|
||||
echo "Formatting partition on $DEV:"
|
||||
mkfs.vfat -F 16 -n "NOOBS" ${DEV}1
|
||||
echo "...done"
|
||||
|
||||
echo "Mounting partition on $DEV:"
|
||||
mkdir -p /tmp/sdcard.$$
|
||||
mount -t vfat "${DEV}1" /tmp/sdcard.$$
|
||||
echo "...done"
|
||||
|
||||
echo "Downloading latest NOOBS:"
|
||||
curl -#Lo /tmp/noobs.zip http://downloads.raspberrypi.org/NOOBS_latest
|
||||
echo "...done"
|
||||
|
||||
echo "Unzipping to SD card..."
|
||||
unzip -q -d /tmp/sdcard.$$ /tmp/noobs.zip
|
||||
echo "...done"
|
||||
|
||||
# get NOOBS version info
|
||||
NOOBS_VERSION=`grep -i "^NOOBS Version:" /tmp/sdcard.$$/BUILD-DATA | cut -d':' -f2 | tr -d '[[:space:]]'`
|
||||
BUILD_DATE=`grep -i "^Build-date:" /tmp/sdcard.$$/BUILD-DATA | cut -d':' -f2 | tr -d '[[:space:]]'`
|
||||
|
||||
echo "unmounting SD card..."
|
||||
sync;sync;sync
|
||||
umount /tmp/sdcard.$$
|
||||
echo "...done"
|
||||
|
||||
rm -f /tmp/noobs.zip
|
||||
rmdir /tmp/sdcard.$$
|
||||
echo "NOOBS $NOOBS_VERSION ($BUILD_DATE) has been installed and is ready to be booted."
|
Loading…
Add table
Add a link
Reference in a new issue