Skip to content
Snippets Groups Projects
Verified Commit f5edc2c7 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Merge branch 'master' of git.nic.cz:turris/misc

parents 2d3be716 25c7d529
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
mkdir -p meta/1.0
rm -f meta/1.0/index-system*
mkdir -p images
rm -rf images/*
DATE="`date +%Y-%m-%d`"
add_image() {
echo "$1;$2;$3;default;$DATE;/images/$1/$2/$3/$DATE" >> meta/1.0/index-system.2
mkdir -p "images/$1/$2/$3/$DATE"
pushd "images/$1/$2/$3/$DATE"
wget "$4"
FILE="`ls -1`"
if expr "$FILE" : .*\\.tbz || expr "$FILE" : .*\\.tar.bz2; then
bzip2 -d "$FILE"
FILE="`echo "$FILE" | sed -e 's|\.tbz$|.tar|' -e 's|\.tar\.bz2$|.tar|'`"
elif expr "$FILE" : .*\\.tgz || expr "$FILE" : .*\\.tar.gz; then
gzip -d "$FILE"
FILE="`echo "$FILE" | sed -e 's|\.tgz$|.tar|' -e 's|\.tar\.gz$|.tar|'`"
fi
mv "$FILE" rootfs.tar
xz -9 rootfs.tar
echo "Distribution $1 version $2 was just installed into your container." > create-message
echo "" >> create-message
echo "Content of the tarballs is provided by third party, thus there is no warranty of any kind." >> create-message
echo "lxc.arch = armv7l" > config
expr `date +%s` + 1209600 > expiry
tar -cJf meta.tar.xz create-message config expiry
rm -f create-message config expiry
popd
}
get_gentoo_url() {
REL="`wget -O - http://distfiles.gentoo.org/releases/$1/autobuilds/latest-stage3-$2.txt | sed -n 's|\(.*\.tar.bz2\).*|\1|p'`"
echo "http://distfiles.gentoo.org/releases/$1/autobuilds/$REL"
}
get_omnia_url() {
REL="`wget -O - https://api.turris.cz/openwrt-repo/omnia/ | sed -n 's|.*>\(omnia-medkit[^<]*\)<.*|\1|p'`"
echo "https://api.turris.cz/openwrt-repo/omnia/$REL"
}
add_image "Turris_OS" "stable" "armv7l" "`get_omnia_url`"
add_image "Turris_OS" "stable" "ppc" "https://api.turris.cz/openwrt-repo/turris/openwrt-mpc85xx-p2020-nand-TURRISNAND-rootfs.tar.gz"
add_image "Arch_Linux_ARM" "latest" "armv7l" "https://archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz"
add_image "Gentoo" "stable" "armv7l" "`get_gentoo_url arm armv7a_hardfp`"
add_image "openSUSE" "13.2" "armv7l" "http://download.opensuse.org/ports/armv7hl/distribution/13.2/appliances/openSUSE-13.2-ARM-JeOS.armv7-rootfs.armv7l-Current.tbz"
add_image "openSUSE" "Tumbleweed" "armv7l" "http://download.opensuse.org/ports/armv7hl/tumbleweed/images/openSUSE-Tumbleweed-ARM-JeOS.armv7-rootfs.armv7l-Current.tbz"
add_image "Ubuntu_Cloud" "16.04" "armv7l" "https://uec-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-armhf-root.tar.gz"
if [ "`gpg -K`" ]; then
if [ -f ~/gpg-pass ]; then
find . -type f -exec echo cat ~/gpg-pass \| gpg --batch --no-tty --yes --passphrase-fd 0 -a --detach-sign \{\} \; | sh
else
find . -type f -exec gpg -a --detach-sign \{\} \;
fi
fi
#!/bin/sh
# We are using separate feeds nowadays so disable old feed as it does not exist anymore
sed -i 's|^\([^#]*https://api.turris.cz/openwrt-repo/turris/packages\)|# deprecated \1|' /etc/opkg.conf
......@@ -3,6 +3,7 @@
import sys
import os
import select
import time
sfpdet_pin = 508
sfpdis_pin = 505
......@@ -10,7 +11,8 @@ sfpdis_pin = 505
gpio_export = '/sys/class/gpio/export'
sfp_select = '/sys/devices/platform/soc/soc:internal-regs/f1034000.ethernet/net/eth1/phy_select'
map = { 1: 'phy-def', 0: 'phy-sfp' }
cmd_net_res = '/etc/init.d/network restart'
cmd_net_res = 'ip link set down dev eth1; /etc/init.d/network restart'
cmd_safety_sleep = 2
def write_once(path, value):
with open(path, 'w') as f:
......@@ -47,6 +49,7 @@ def do_switch(state, restart_net=True):
print 'Switching state to %s' % map[state]
write_once(sfp_select, map[state])
if restart_net:
time.sleep(cmd_safety_sleep)
os.system(cmd_net_res)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment