summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO22
-rw-r--r--.gitignore4
-rw-r--r--Change-default-key-path.patch26
-rw-r--r--PKGBUILD43
-rw-r--r--Remove-embedded-SoftCam-key.patch82
-rw-r--r--osemu.install6
6 files changed, 183 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..a18e5dd27b3d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,22 @@
+pkgbase = osemu-git
+ pkgdesc = A simple (micro) emu for oscam
+ pkgver = 732
+ pkgrel = 1
+ url = https://github.com/oscam-emu/OSEmu
+ install = osemu.install
+ arch = x86_64
+ arch = i686
+ arch = arm
+ arch = armv6h
+ arch = armv7h
+ license = GPL3
+ depends = oscam-git
+ source = osemu-git::git+https://github.com/oscam-emu/OSEmu.git
+ source = Remove-embedded-SoftCam-key.patch
+ source = Change-default-key-path.patch
+ sha256sums = SKIP
+ sha256sums = b1d6b39908625e97f22d8e7f7a6bdb7be20b5761ceaa6fa2bc3181333877f4c2
+ sha256sums = 6839b6901aa1fdd39bcc6feb47aeab52bb911627a8d32b9c71f138f4948051a6
+
+pkgname = osemu-git
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..3d39b55db459
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+src/
+pkg/
+osemu-git/
+*.tar*
diff --git a/Change-default-key-path.patch b/Change-default-key-path.patch
new file mode 100644
index 000000000000..aee1aeb18f02
--- /dev/null
+++ b/Change-default-key-path.patch
@@ -0,0 +1,26 @@
+diff --git a/OSEmu.c b/OSEmu.c
+index 35a3066..39e5745 100755
+--- a/OSEmu.c
++++ b/OSEmu.c
+@@ -494,7 +494,7 @@ int main(int argc, char**argv)
+ get_random_bytes_init();
+
+ if(!read_emu_keyfile(path)) {
+- read_emu_keyfile("/var/keys/");
++ read_emu_keyfile("/var/lib/oscam/keys/");
+ }
+
+ if(start_relay && !stream_server_thread_init)
+diff --git a/README b/README
+index 2eb749e..f4ec87c 100644
+--- a/README
++++ b/README
+@@ -21,7 +21,7 @@ Run:
+
+ - (optional) OSEmu does not require, but will make use of "SoftCam.Key" if available.
+ "SoftCam.Key" is searched in:
+- - /var/keys
++ - /var/lib/oscam/keys
+ - The folder specified with the "-c <folder>" option.
+
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..3817836feae1
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,43 @@
+# Maintainer: Alexander Sulfrian <asulfrian at zedat dot fu-berlin dot de>
+
+pkgname='osemu-git'
+pkgver=732
+pkgrel=1
+pkgdesc='A simple (micro) emu for oscam'
+arch=('x86_64' 'i686' 'arm' 'armv6h' 'armv7h')
+url='https://github.com/oscam-emu/OSEmu'
+license=('GPL3')
+depends=('oscam-git')
+install='osemu.install'
+source=("$pkgname::git+https://github.com/oscam-emu/OSEmu.git"
+ 'Remove-embedded-SoftCam-key.patch'
+ 'Change-default-key-path.patch')
+sha256sums=('SKIP'
+ 'b1d6b39908625e97f22d8e7f7a6bdb7be20b5761ceaa6fa2bc3181333877f4c2'
+ '6839b6901aa1fdd39bcc6feb47aeab52bb911627a8d32b9c71f138f4948051a6')
+
+pkgver() {
+ cd "$srcdir/$pkgname"
+ sed -n 's/^\$Version: \([0-9]*\) *\$$/\1/p' VERSION
+}
+
+prepare() {
+ cd "$srcdir/$pkgname"
+ patch -Np1 -i "$srcdir/Remove-embedded-SoftCam-key.patch"
+ patch -Np1 -i "$srcdir/Change-default-key-path.patch"
+}
+
+build() {
+ cd "$srcdir/$pkgname"
+}
+
+package() {
+ cd "$srcdir/$pkgname"
+
+ # Install binary
+ install -Dm755 OSEmu "$pkgdir/usr/bin/osemu"
+
+ # Install docs
+ mkdir -p "$pkgdir/usr/share/doc/$pkgname"
+ install -Dm644 README "$pkgdir/usr/share/doc/$pkgname"
+}
diff --git a/Remove-embedded-SoftCam-key.patch b/Remove-embedded-SoftCam-key.patch
new file mode 100644
index 000000000000..f47c30a2b0ca
--- /dev/null
+++ b/Remove-embedded-SoftCam-key.patch
@@ -0,0 +1,82 @@
+diff --git a/Makefile b/Makefile
+index adbc36c..006c6a1 100755
+--- a/Makefile
++++ b/Makefile
+@@ -44,10 +44,8 @@ else ifdef ANDROID_NDK
+ else ifdef ANDROID_STANDALONE_TOOLCHAIN
+ $(Q)$(CC) $(CC_WARN) -o $(BIN) $(OBJS) $(CFLAGS) $(LFLAGS)
+ else
+- touch SoftCam.Key
+- $(Q)$(CC) $(CC_WARN) -o $(BIN) $(OBJS) $(CFLAGS) $(LFLAGS) -Wl,--format=binary -Wl,SoftCam.Key -Wl,--format=default
++ $(Q)$(CC) $(CC_WARN) -o $(BIN) $(OBJS) $(CFLAGS) $(LFLAGS)
+ endif
+- $(STRIP) $(BIN)
+
+ clean:
+ rm -rf $(BIN) $(OBJS) $(DEPS)
+diff --git a/module-emulator-osemu.c b/module-emulator-osemu.c
+index 5f1c76e..8d0c88c 100644
+--- a/module-emulator-osemu.c
++++ b/module-emulator-osemu.c
+@@ -579,46 +579,6 @@ uint8_t read_emu_keyfile(const char *opath)
+ return 1;
+ }
+
+-#if !defined(__APPLE__) && !defined(__ANDROID__)
+-extern uint8_t SoftCamKey_Data[] __asm__("_binary_SoftCam_Key_start");
+-extern uint8_t SoftCamKey_DataEnd[] __asm__("_binary_SoftCam_Key_end");
+-
+-void read_emu_keymemory(void)
+-{
+- char *keyData, *line, *saveptr, keyName[EMU_MAX_CHAR_KEYNAME], keyString[1026];
+- uint32_t provider, keyLength;
+- uint8_t *key;
+- char identifier;
+-
+- keyData = (char*)malloc(SoftCamKey_DataEnd-SoftCamKey_Data+1);
+- if(keyData == NULL) {
+- return;
+- }
+- memcpy(keyData, SoftCamKey_Data, SoftCamKey_DataEnd-SoftCamKey_Data);
+- keyData[SoftCamKey_DataEnd-SoftCamKey_Data] = 0x00;
+-
+- line = strtok_r(keyData, "\n", &saveptr);
+- while(line != NULL) {
+- if(sscanf(line, "%c %8x %11s %1024s", &identifier, &provider, keyName, keyString) != 4) {
+- line = strtok_r(NULL, "\n", &saveptr);
+- continue;
+- }
+- keyLength = strlen(keyString)/2;
+- key = (uint8_t*)malloc(keyLength);
+- if(key == NULL) {
+- free(keyData);
+- return;
+- }
+-
+- CharToBin(key, keyString, strlen(keyString));
+- SetKey(identifier, provider, keyName, key, keyLength, 0, NULL);
+- free(key);
+- line = strtok_r(NULL, "\n", &saveptr);
+- }
+- free(keyData);
+-}
+-#endif
+-
+ // Shared functions
+
+ static inline uint16_t GetEcmLen(const uint8_t *ecm)
+diff --git a/OSEmu.c b/OSEmu.c
+index 35a3066..c594f43 100755
+--- a/OSEmu.c
++++ b/OSEmu.c
+@@ -493,10 +493,6 @@ int main(int argc, char**argv)
+
+ get_random_bytes_init();
+
+-#if !defined(__APPLE__) && !defined(__ANDROID__)
+- read_emu_keymemory();
+-#endif
+-
+ if(!read_emu_keyfile(path)) {
+ read_emu_keyfile("/var/keys/");
+ }
diff --git a/osemu.install b/osemu.install
new file mode 100644
index 000000000000..1f5a05d9867d
--- /dev/null
+++ b/osemu.install
@@ -0,0 +1,6 @@
+post_install() {
+ if [ ! -d /var/lib/oscam/keys/ ]; then
+ mkdir -p /var/lib/oscam/keys/
+ chown -R oscam:oscam /var/lib/oscam/keys/
+ fi
+}