Merge git://git.sysmocom.de/poky/meta-sysmocom-bsp into edison

e518a3224a
This commit is contained in:
Holger Hans Peter Freyther 2013-03-02 17:06:31 +01:00
commit 52ddf4d91b
7 changed files with 105 additions and 8 deletions

View File

@ -0,0 +1,56 @@
#!/bin/sh
# Make sure to look at sysmocom-restore to check if the file would
# be restored right. Currently only some dirs get restored.
FILES="\
etc/openvpn
etc/osmocom/osmo-bsc-mgcp.cfg \
etc/osmocom/osmo-bsc.cfg \
etc/osmocom/osmo-bts.cfg \
etc/osmocom/osmo-nitb.cfg \
etc/osmocom/osmo-pcu.cfg \
etc/osmocom/osmo-sgsn.cfg \
etc/ggsn.conf \
etc/default/osmo-nitb \
etc/default/osmo-bsc \
etc/default/osmocom-tcpdump \
var/lib/osmocom/hlr.sqlite3 \
"
DATE=`date +%Y%m%d`
do_backup_files() {
BACKUP_FILE="/home/root/sysmocom-backup_$DATE.tar"
# 0. Sanity checking
if [ -e $BACKUP_FILE ]; then
echo "The backup file '$BACKUP_FILE' already exists. Exiting!"
exit 1
fi
# 1. Create an empty archive..
tar -cf $BACKUP_FILE --files-from=/dev/null
# 2. Add all the files... we need
for file in $FILES;
do
if [ -e "/$file" ]; then
tar -rf $BACKUP_FILE --transform='s,^,content/,' -C / $file
fi
done
# 3. Generate more information
NAME="/tmp/backup.$RANDOM"
mkdir $NAME
opkg list_installed > $NAME/installed_packages
/sbin/ifconfig | grep HWaddr | cut -d ' ' -f 11 > $NAME/mac_addr
# 4. Add the more information
tar -rf $BACKUP_FILE --transform='s,^,info/,' -C $NAME installed_packages mac_addr
# 5.
echo "The backup was stored to $BACKUP_FILE"
}
do_backup_files

View File

@ -0,0 +1,26 @@
#!/bin/sh
do_extract() {
# List the files and check if grep hits something
SEARCH=`tar -tvf $1 | grep $2`
RES=$?
if [ $RES = 0 ]; then
tar -C / -xvf $1 --strip=1 $2
else
echo "Directory '$2' is not in backup '$1'."
fi
}
do_restore_files() {
BACKUP_FILE=$1
if [ ! -e "$BACKUP_FILE" ] ; then
echo "The backup file '$BACKUP_FILE' does not exist. Exiting!"
exit 1
fi
echo "Going to extract files from the backup '$BACKUP_FILE'"
do_extract $BACKUP_FILE content/etc
do_extract $BACKUP_FILE content/var/lib/osmocom
}
do_restore_files $1

View File

@ -0,0 +1,13 @@
DESCRIPTION = "sysmocom config backup and restore scripts"
LICENSE = "GPLv3+"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
PR = "r3"
SRC_URI = "file://sysmocom-backup file://sysmocom-restore"
RDEPENDS_${PN} = "tar"
do_install() {
install -d ${D}${sbindir}
install -m 0755 ${WORKDIR}/sysmocom-backup ${D}${sbindir}/
install -m 0755 ${WORKDIR}/sysmocom-restore ${D}${sbindir}/
}

View File

@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
DEPENDS = "virtual/kernel"
ALLOW_EMPTY = "1"
PR = "r9"
PR = "r10"
RDEPENDS_task-sysmocom = "\
task-sysmocom-tools \
@ -16,5 +16,6 @@ RDEPENDS_task-sysmocom = "\
ipaccess-utils \
wget \
ca-cacert-rootcert \
sysmocom-backup \
"

View File

@ -1,4 +1,4 @@
THISDIR := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
FILESPATH =. "${@base_set_filespath(["${THISDIR}/files"], d)}:"
PRINC="3"
PRINC="4"

View File

@ -15,6 +15,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/dropbear
NAME=dropbear
DESC="Dropbear SSH server"
PIDFILE=/var/run/dropbear.pid
DROPBEAR_PORT=22
DROPBEAR_EXTRA_ARGS=
@ -80,24 +81,24 @@ case "$1" in
KEY_ARGS=""
test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
start-stop-daemon -S \
start-stop-daemon -S -p $PIDFILE \
-x "$DAEMON" -- $KEY_ARGS \
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon -K -x "$DAEMON"
start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon -K -x "$DAEMON"
start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
sleep 1
KEY_ARGS=""
test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
start-stop-daemon -S \
start-stop-daemon -S -p $PIDFILE \
-x "$DAEMON" -- $KEY_ARGS \
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
echo "$NAME."

View File

@ -5,12 +5,12 @@ LIC_FILES_CHKSUM="file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "git://git.osmocom.org/osmo-pcu.git;protocol=git;branch=jolly_merge"
SRCREV = "9aaf2ae24d544ce149fde7685ca0421d31262a09"
PV = "0.1+git${SRCPV}"
PR = "r8.${META_TELEPHONY_OSMO_INC}"
PR = "r9.${META_TELEPHONY_OSMO_INC}"
S = "${WORKDIR}/git"
DEPENDS = "libosmocore femtobts-api osmo-bts"
EXTRA_OECONF += "--enable-sysmocom-bts --enable-sysmocom-dsp"
EXTRA_OECONF_sysmobts_v2 += "--enable-sysmocom-bts --enable-sysmocom-dsp"
inherit autotools_stage