forked from mwarning/openwrt-firmware-selector
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
The files in this directory aren't in git and shouldn't be added to | ||
it. They are symbolic links to their counterparts in the www/-dir. | ||
|
||
In that way, we can preserve campability with the upstream repo, but | ||
deploy falter-selector at its normal web-address. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#! /usr/bin/python3 | ||
|
||
"""Fetch the profiles from buildbot-unstable-dir | ||
and feed them into the firmware-selector """ | ||
|
||
import requests | ||
import shutil | ||
import time | ||
import sys | ||
import os | ||
import re | ||
|
||
|
||
def find_subdirs(url, regex): | ||
r = requests.get(url) | ||
subdirs = re.findall(regex, r.text) | ||
return subdirs | ||
|
||
try: | ||
print("fetching data from " + sys.argv[2]) | ||
except: | ||
print("Usage:\n\t./get_profiles_from [URL]\n\nPlease give an URL to the buildbot-dir.") | ||
print("Example:\n\t./get_profiles_from http://buildbot.berlin.freifunk.net/buildbot/unstable/2020-12-19/") | ||
exit(1) | ||
|
||
image_types = find_subdirs(sys.argv[1], "\"(\w*\/)\"") | ||
#print(image_types) | ||
|
||
profiles_root = sys.argv[1].split(sep='/')[-2] | ||
try: | ||
os.mkdir(profiles_root) | ||
except: | ||
shutil.rmtree(profiles_root) | ||
os.mkdir(profiles_root) | ||
|
||
for itype in image_types: | ||
link = sys.argv[1] + itype | ||
|
||
# write stuff into own directory | ||
try: | ||
os.mkdir(itype) | ||
except: | ||
shutil.rmtree(itype) | ||
os.mkdir(itype) | ||
|
||
os.mkdir(itype+"www/") | ||
os.system("touch "+itype+"www/config.js") | ||
|
||
command = "./misc/collect.py --image-url '"+link+"{target}' "+sys.argv[2]+" "+itype+"www/" | ||
os.system(command) | ||
|
||
src_dir = [f.path for f in os.scandir(itype+"www/data/") if f.is_dir()][0] | ||
dirs_to_move = [f.path for f in os.scandir(src_dir)] | ||
|
||
|
||
# move dirs to first hirachy-step | ||
for fd in dirs_to_move: | ||
shutil.move(fd, itype) | ||
shutil.rmtree(itype+"www/") | ||
|
||
shutil.move(itype, profiles_root) | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This script regularily updates the overview-files for the firmware-selector by pulling | ||
# the snapshot images from the buildbor-dir. It gets called by a cronjob. | ||
|
||
REALPATH_SCRIPT=$(realpath "$0") | ||
SCRIPT_DIR=$(dirname "$REALPATH_SCRIPT") | ||
cd $SCRIPT_DIR | ||
|
||
for DIR in $(ls /usr/local/src/www/htdocs/buildbot/unstable/ | grep snapshot); do | ||
./get_profiles_local.py "https://firmware.berlin.freifunk.net/unstable/$DIR/" /usr/local/src/www/htdocs/buildbot/unstable/$DIR/ | ||
done |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
# link every file in www-folder to this folder | ||
|
||
for FILE in $(ls www/); do | ||
ln -s www/$FILE $FILE | ||
done |