Skip to content

Instantly share code, notes, and snippets.

@jfisbein
Last active April 27, 2023 23:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jfisbein/d1a164ee80e9206e70c3f6fdb99c4e4d to your computer and use it in GitHub Desktop.
Save jfisbein/d1a164ee80e9206e70c3f6fdb99c4e4d to your computer and use it in GitHub Desktop.
install and update oscam on raspbian
#!/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
@mihaibalaci
Copy link

how can i change the port for oscam? i am not able to find the config files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment