Last active
May 12, 2024 08:59
-
-
Save jfisbein/d1a164ee80e9206e70c3f6fdb99c4e4d to your computer and use it in GitHub Desktop.
install and update oscam on raspbian
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 | |
set -e | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
function install() { | |
apt-get -y install apt-utils dialog usbutils gcc g++ wget build-essential subversion libpcsclite1 libpcsclite-dev libssl-dev cmake make libusb-1.0-0-dev nano pcscd pcsc-tools | |
ln -s /usr/lib/arm-linux-gnueabihf/libusb-1.0.a /usr/local/lib/libusb-1.0.a | |
cd /usr/src | |
svn co http://www.streamboard.tv/svn/oscam/trunk oscam-svn | |
build | |
mkdir -p /var/log/oscam | |
install-service | |
} | |
function update() { | |
if is-update-needed; then | |
cd /usr/src/oscam-svn | |
svn update | |
systemctl stop oscam | |
build | |
systemctl start oscam | |
else | |
echo "Already at latest revision" | |
fi | |
} | |
function build() { | |
cd /usr/src/oscam-svn | |
rm -rf build | |
mkdir build | |
chmod 755 build | |
cd build | |
cmake -DHAVE_LIBUSB=1 -DHAVE_PCSC=1 -DWEBIF=1 -DHAVE_LIBCRYPTO=1 -DWITH_SSL=1 .. | |
make | |
cp oscam /var/local/ | |
} | |
function is-update-needed() { | |
cd /usr/src/oscam-svn | |
local LAST_REVISION=$(svn info -r HEAD | grep -i "Last Changed Rev" | cut -d' ' -f4) | |
local CURRENT_REVISION=$(svn info | grep -i "Last Changed Rev" | cut -d' ' -f4) | |
if [[ $LAST_REVISION>$CURRENT_REVISION ]]; then | |
return 0 | |
else | |
return 1 | |
fi | |
} | |
function install-service() { | |
cat > /etc/systemd/system/oscam.service <<EOF | |
## more info: http://techblog.thomserve.co.uk/2016/09/30/systemd-script-for-oscam/ | |
[Unit] | |
Description=OScam | |
After=network.target | |
Requires=network.target | |
[Service] | |
Type=forking | |
PIDFile=/var/run/oscam.pid | |
ExecStart=/var/local/oscam --daemon --pidfile /var/run/oscam.pid | |
ExecStop=/usr/bin/rm /var/run/oscam.pid | |
TimeoutStopSec=1 | |
Restart=always | |
RestartSec=5 | |
StartLimitInterval=0 | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
systemctl daemon-reload | |
systemctl start oscam | |
systemctl status oscam | |
} | |
if [[ -d /usr/src/oscam-svn/ ]]; then | |
update | |
else | |
install | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how can i change the port for oscam? i am not able to find the config files