Use #!/usr/bin/env shebang instead
Using `#!/usr/bin/env bash` instead of `#!/bin/bash` makes scripts more portable. bash isn't guaranteed to be in /bin/ on every system. /usr/bin/env uses the users's path, which should always find bash for us. (Technically we could make it even *more* portable via
This commit is contained in:
parent
3ac8ba51ab
commit
b6a02d14db
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Abort if any command fails.
|
||||
set -e
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
feed2exec \
|
||||
parse \
|
||||
https://www.nasa.gov/rss/dyn/breaking_news.rss \
|
||||
|
|
|
@ -1,51 +1,5 @@
|
|||
#!/bin/bash
|
||||
# Abort if any command fails.
|
||||
set -e
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Check for presence of a command.
|
||||
# $1 is name of dependency
|
||||
# $2 is command that gets run to check for it
|
||||
# eg. check "disroot.org reachable?" "ping disroot.org"
|
||||
check() {
|
||||
echo -n "Checking for $1... "
|
||||
|
||||
if eval $2 &> /dev/null ; then
|
||||
echo ✔︎
|
||||
false
|
||||
else
|
||||
echo ✗
|
||||
storytime_ready=false
|
||||
true
|
||||
fi
|
||||
}
|
||||
|
||||
# assume ready until proven otherwise
|
||||
storytime_ready=true
|
||||
|
||||
if check "cron" "crontab -l"; then
|
||||
echo " Please install cron."
|
||||
fi
|
||||
|
||||
if check "mimic3" "mimic3 --version"; then
|
||||
echo " Please install mimic3."
|
||||
echo " Via pip: pip3 install mycroft-mimic3-tts[all]"
|
||||
fi
|
||||
|
||||
if check "ffmpeg 7" "ffmpeg -version | grep \"ffmpeg version 7\""; then
|
||||
echo " Please install ffmpeg ~7."
|
||||
fi
|
||||
|
||||
if check "feed2exec" "feed2exec"; then
|
||||
echo " Please install feed2exec."
|
||||
echo " Via pip: pip3 install feed2exec"
|
||||
fi
|
||||
|
||||
# final check for readiness
|
||||
if $storytime_ready; then
|
||||
echo -e "\nReady for Storytime!"
|
||||
else
|
||||
echo -e "\nStorytime is not ready to go. Please install the missing dependencies."
|
||||
fi
|
||||
figlet "Fetching feed items."
|
||||
figlet "Reading into an audio file."
|
||||
figlet "Mixing video."
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mimic3 --voice en_US/hifi-tts_low#92 --length-scale .95 "$1" > /tmp/stage.wav
|
||||
ffmpeg -y -i /tmp/stage.wav -f s16le -acodec pcm_s16le -ar 22050 -c:a libmp3lame /tmp/output.mp3
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ffmpeg -loop 1 -i ../media-assets/sample_pic.png \
|
||||
-i /tmp/output.mp3 \
|
||||
-shortest \
|
||||
|
|
Loading…
Reference in New Issue