Last active
May 12, 2019 15:13
-
-
Save e-roux/6e90dae183e4e4f010078a7d861738aa to your computer and use it in GitHub Desktop.
Bash scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# File: indent.sh | |
# Opens a set of files in emacs and executes the emacs-format-function. | |
# | |
# This one is based on: | |
# http://www.cslab.pepperdine.edu/warford/BatchIndentationEmacs.html | |
emacsscript=/tmp/.emacs-indent | |
cat > ${emacsscript} << EOF | |
(defun indent-file () | |
"Format the whole buffer." | |
(indent-region (point-min) (point-max) nil) | |
(untabify (point-min) (point-max)) | |
(save-buffer) | |
) | |
EOF | |
# get script name | |
script=$(basename $0) | |
if [ $# -eq 0 ] | |
then | |
echo "${script} requires at least one argument." 1>&2 | |
echo "Usage: ${script} files-to-indent" 1>&2 | |
exit 1 | |
fi | |
while [ $# -ge 1 ] | |
do | |
if [ -d $1 ] | |
then | |
echo "Argument of ${script} $1 cannot be a directory." 1>&2 | |
exit 1 | |
fi | |
# Check for existence of file: | |
ls $1 2> /dev/null | grep $1 > /dev/null | |
if [ $? != 0 ] | |
then | |
echo "${script}: $1 not found." 1>&2 | |
exit 1 | |
fi | |
echo "Indenting $1 with emacs in batch mode" | |
emacs -batch $1 -l ${emacsscript} -f indent-file | |
echo | |
shift 1 | |
done | |
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# If no DVB adapter present, break | |
dmesg | grep -i DVB > /dev/null | |
if (($? != 0)); then exit 1;fi | |
# Install Firmware | |
sudo wget -q https://github.com/OpenELEC/dvb-firmware/blob/master/firmware/dvb-demod-m88ds3103.fw?raw=true -O /lib/firmware/dvb-demod-m88ds3103.fw | |
#--------------------------------------------------------- | |
# Get sources | |
#--------------------------------------------------------- | |
cd /tmp | |
# Récupération des sources, dernière version stable | |
wget ftp://ftp.tvdr.de/vdr/vdr-current.tar.bz2 | |
# Extraction dans le répertoire vdr-src | |
mkdir vdr-src | |
tar xf vdr-current.tar.bz2 --directory vdr-src | |
cd vdr-src/vdr* | |
#--------------------------------------------------------- | |
# PLUGINS | |
#--------------------------------------------------------- | |
cd PLUGINS/src | |
# vnsiserver | |
git clone https://github.com/FernetMenta/vdr-plugin-vnsiserver | |
ln -s vdr-plugin-vnsiserver/ vnsiserver | |
# streamdev | |
git clone git://projects.vdr-developer.org/vdr-plugin-streamdev.git | |
ln -s vdr-plugin-streamdev streamdev | |
cd - | |
#--------------------------------------------------------- | |
# Make and install | |
#--------------------------------------------------------- | |
make | |
sudo make install | |
# create a user vdr | |
sudo groupadd vdr | |
sudo useradd --home /media/vdr -c "vdr daemon" -m -g vdr -G video,audio vdr | |
sudo usermod -L vdr | |
#--------------------------------------------------------- | |
# streamdev and vnsiserver configuration | |
#--------------------------------------------------------- | |
sudo mkdir -p /var/lib/vdr/plugins/streamdev-server | |
mask="$(ifconfig | sed -rn '2s/.*:(192.*)255 .*$/\1/p')0" | |
sudo bash -c "cat << EOF > /var/lib/vdr/plugins/streamdev-server/streamdevhosts.conf | |
# | |
# streamdevhosts This file describes a number of host addresses that | |
# are allowed to connect to the streamdev server running | |
# with the Video Disk Recorder (VDR) on this system. | |
# Accept localhost and any host on the local net | |
# Syntax: | |
# | |
# IP-Address[/Netmask] | |
# | |
127.0.0.1 | |
${mask}/24 | |
EOF | |
" | |
sudo bash -c "cat << EOF > /var/lib/vdr/plugins/vnsiserver/allowed_hosts.conf | |
# | |
# allowed_hosts.conf This file describes a number of host addresses that | |
# are allowed to connect to the streamdev server running | |
# with the Video Disk Recorder (VDR) on this system. | |
# Accept localhost and any host on the local net | |
# Syntax: | |
# | |
# IP-Address[/Netmask] | |
# | |
127.0.0.1 | |
${mask}/24 | |
EOF | |
" | |
sudo bash -c "cat << EOF > /var/lib/vdr/plugins/svdrphosts.conf | |
# | |
# svdrphosts This file describes a number of host addresses that | |
# are allowed to connect to the SVDRP port of the Video | |
# Disk Recorder (VDR) running on this system. | |
# Accept localhost and any host on the local net | |
# | |
# | |
# Syntax: | |
# | |
# IP-Address[/Netmask] | |
# | |
127.0.0.1 | |
${mask}/24 | |
EOF | |
" | |
sudo chown -R vdr.vdr /var/lib/vdr /var/cache/vdr /usr/local/lib/vdr /usr/local/bin/vdr /usr/local/share/vdr /usr/local/include/vdr /etc/vdr | |
mkdir -p /media/tv/ | |
chown vdr /media/tv/install_vdr.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment