From eeaa262d92a3d4fb1d8b0826385b87f0933dbf01 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Mon, 27 Nov 2017 21:50:23 +0100 Subject: dev to prod (LEDE 17.01.4) --- build-openwrt.sh | 237 +++++++++++++------------------------------------------ maj/gen.php | 15 ++-- 2 files changed, 64 insertions(+), 188 deletions(-) diff --git a/build-openwrt.sh b/build-openwrt.sh index 7a14dc1..95a79a5 100755 --- a/build-openwrt.sh +++ b/build-openwrt.sh @@ -24,8 +24,8 @@ echo -n "$0 - " ; date # Directories and source file URL BUILD_DIR=${BUILD_DIR:-./build} CACHE_DIR=${CACHE_DIR:-.} -ORIG_TARBALL=lede-imagebuilder-17.01.2-ar71xx-generic.Linux-x86_64.tar.xz -ORIG_URL=https://downloads.lede-project.org/releases/17.01.2/targets/ar71xx/generic/$ORIG_TARBALL +ORIG_TARBALL=lede-imagebuilder-17.01.4-ar71xx-generic.Linux-x86_64.tar.xz +ORIG_URL=https://downloads.lede-project.org/releases/17.01.4/targets/ar71xx/generic/$ORIG_TARBALL PACKAGES="luci luci-mod-admin-full ip kmod-leds-gpio" # Base packages PACKAGES="$PACKAGES luci-i18n-base-en luci-i18n-firewall-en luci-i18n-base-fr luci-i18n-firewall-fr" # internationalisation PACKAGES="$PACKAGES -kmod-ppp -kmod-pppoe -kmod-pppox" # Unusefull kernel modules @@ -38,6 +38,7 @@ then echo "Usage: $0 < fi dnslist="185.131.40.1 fe80::31" +logserv="172.16.0.253" profile=$1 @@ -98,7 +99,8 @@ fi cd "$BUILD_DIR/" || exit 5 -mkdir -p extra_files/etc/config extra_files/etc/dropbear extra_files/etc/hotplug.d/button +[ -d extra_files/ ] && rm -r extra_files/ +mkdir -p extra_files/etc/{config,dropbear,sysctl.d} ############################### # Prepare Openwrt config file # @@ -121,6 +123,7 @@ daemon:*:0:0:99999:7::: ftp:*:0:0:99999:7::: network:*:0:0:99999:7::: nobody:*:0:0:99999:7::: +dnsmasq:x:0:0:99999:7::: EOF cat > extra_files/etc/rc.local < extra_files/etc/rc.local </var/log/initconf.log 2>&1 exit 0 EOF +cat > extra_files/etc/rc.initconf < extra_files/etc/config/network < extra_files/etc/config/wireless < extra_files/etc/config/dhcp < extra_files/etc/config/dropbear < extra_files/etc/config/firewall < extra_files/etc/firewall.user < extra_files/etc/hotplug.d/button/01onoff <<"EOF" -#!/bin/sh +# Internal uci firewall chains are flushed and recreated on reload, so +# put custom rules into the root chains e.g. INPUT or FORWARD or into the +# special user chains, e.g. input_wan_rule or postrouting_lan_rule. -[ "$BUTTON" = "wps" ] && [ "$ACTION" = "pressed" ] && { - SW=$(uci get wireless.@wifi-device[0].disabled) - [ $SW == '0' ] && uci set wireless.@wifi-device[0].disabled=1 - [ $SW == '0' ] || uci set wireless.@wifi-device[0].disabled=0 - wifi -} +ip6tables -A input_wan_rule -s fe80::/10 -d fe80::/10 -p tcp -m tcp --dport 22 -m comment --comment "CHD-allow-ssh-maj-routeur" -j ACCEPT EOF +cat > extra_files/etc/sysctl.d/dad.conf <\n\n\n\n\n\n

Oops, une erreur s'est produite

Il y a un problème avec les renseignements fournis
    \n"; @@ -153,21 +153,26 @@ if ( ! flock($fh, LOCK_EX) ) { exit(); } +// Run the imagebuilder make command putenv("CACHE_DIR=$basepath/"); putenv("BUILD_DIR=$basepath/build/"); exec($command, $output, $return_val); +// Match produced file against expected filename +$gen_matchedfiles = glob("$basepath/build/$gen_fileglob"); + // Dump script output in /tmp for troobleshooting file_put_contents(tempnam('/tmp' , $scriptfile.'_'), array($command, "\n", print_r($output,true), "\n",$return_val,"\n")); - -if ( $return_val === 0 ) { +if ( $return_val === 0 && count($gen_matchedfiles) === 1) { header('Content-Type: application/octet-stream'); header("Content-Disposition: attachment; filename=$user_filename"); - readfile("$basepath/build/$gen_filename"); + readfile($gen_matchedfiles[0]); } else { echo "
    \n$command\n\n";
     	echo join($output, "\n") . "\n\n";
    -	echo "Command return value : "; var_dump($return_val);
    +	echo "Expected file pattern : '$basepath/build/$gen_fileglob'"; echo "\n";
    +	echo "Matched files : "; print_r($gen_matchedfiles); echo "\n";
    +	echo "Command return value : "; var_dump($return_val); echo "\n";
     }
     
     fclose($fh);
    -- 
    cgit v1.1