Browse Source

Add update-patches target

Matthias Schiffer 10 years ago
parent
commit
1cc0948597

+ 4 - 0
Makefile

@@ -28,6 +28,10 @@ patch: FORCE
 unpatch: FORCE
 	$(GLUONDIR)/scripts/unpatch.sh $(GLUONDIR)
 
+update-patches: FORCE
+	$(GLUONDIR)/scripts/update-patches.sh $(GLUONDIR)
+	$(GLUONDIR)/scripts/patch.sh $(GLUONDIR)
+
 -include $(TOPDIR)/include/host.mk
 
 _SINGLE=export MAKEFLAGS=$(space);

+ 2 - 2
patches/openwrt/0001-Make-Unifi-images-flashable.patch

@@ -1,5 +1,5 @@
-From 9331b9e86ff3cd1a368ba61721c1555807fa772e Mon Sep 17 00:00:00 2001
-Message-Id: <9331b9e86ff3cd1a368ba61721c1555807fa772e.1388167228.git.mschiffer@universe-factory.net>
+From e541a190d4f54d35043a804f42af746793181405 Mon Sep 17 00:00:00 2001
+Message-Id: <e541a190d4f54d35043a804f42af746793181405.1388240789.git.mschiffer@universe-factory.net>
 From: Matthias Schiffer <mschiffer@universe-factory.net>
 Date: Fri, 27 Dec 2013 18:48:19 +0100
 Subject: [PATCH] Make Unifi images flashable

+ 4 - 4
scripts/patch.sh

@@ -3,12 +3,12 @@
 set -e
 shopt -s nullglob
 
-. $1/modules
+. "$1"/modules
 
 for module in $GLUON_MODULES; do
-	dir=$1/$module
+	dir="$1"/$module
 	git -C $dir checkout -B patched base
 
-	if [ -z $1/patches/$module/*.patch ]; then continue; fi
-	git -C $dir am $1/patches/$module/*.patch
+	if [ -z "$1"/patches/$module/*.patch ]; then continue; fi
+	git -C "$dir" am "$1"/patches/$module/*.patch
 done

+ 3 - 3
scripts/unpatch.sh

@@ -2,9 +2,9 @@
 
 set -e
 
-. $1/modules
+. "$1"/modules
 
 for module in $GLUON_MODULES; do
-	dir=$1/$module
-	git -C $dir checkout base
+	dir="$1"/$module
+	git -C "$dir" checkout base
 done

+ 15 - 0
scripts/update-patches.sh

@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -e
+shopt -s nullglob
+
+. "$1"/modules
+
+for module in $GLUON_MODULES; do
+	dir="$1"/$module
+	git -C "$dir" checkout patched
+
+	rm -f "$1"/patches/$module/*.patch
+	mkdir -p "$1"/patches/$module
+	git -C "$dir" format-patch -o "$1"/patches/$module base 
+done

+ 7 - 7
scripts/update.sh

@@ -2,15 +2,15 @@
 
 set -e
 
-. $1/modules
+. "$1"/modules
 
 for module in $GLUON_MODULES; do
-	dir=$1/$module
-	mkdir -p $dir
-	var=$(echo "$module" | tr '[:lower:]/' '[:upper:]_')
+	dir="$1"/$module
+	mkdir -p "$dir"
+	var=$(echo $module | tr '[:lower:]/' '[:upper:]_')
 	eval repo=\${MODULE_${var}_REPO}
 	eval commit=\${MODULE_${var}_COMMIT}
-	git -C $dir init
-	git -C $dir fetch $repo
-	git -C $dir checkout -B base $commit
+	git -C "$dir" init
+	git -C "$dir" fetch $repo
+	git -C "$dir" checkout -B base $commit
 done