Explorar o código

fix some files, when someone moves the top directory

Waldemar Brodkorb %!s(int64=13) %!d(string=hai) anos
pai
achega
fa330c2594
Modificáronse 2 ficheiros con 21 adicións e 2 borrados
  1. 5 2
      Makefile
  2. 16 0
      scripts/reloc.sh

+ 5 - 2
Makefile

@@ -4,7 +4,7 @@
 _UNLIMIT=	__limit=$$(ulimit -dH 2>/dev/null); \
 		test -n "$$__limit" && ulimit -dS $$__limit;
 
-all: .prereq_done
+all: checkreloc .prereq_done
 	@${_UNLIMIT} ${GMAKE_INV} all
 
 v: .prereq_done
@@ -224,4 +224,7 @@ NO_ERROR=0
 	@touch .adkinit
 	@touch $@
 
-.PHONY: prereq prereq-noerror
+checkreloc:
+	@bash scripts/reloc.sh
+
+.PHONY: prereq prereq-noerror checkreloc

+ 16 - 0
scripts/reloc.sh

@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+# execute this after relocation of adk directory
+
+olddir=$(grep "^TOPDIR" prereq.mk |cut -d '=' -f 2)
+newdir=$(pwd)
+
+if [ "$olddir" != "$newdir" ];then
+	echo "adk directory relocated!"
+	echo "old directory: $olddir"
+	echo "new directory: $newdir"
+	sed -i -e "s#$olddir#$newdir#g" $(find target_* -name \*.pc|xargs)
+	sed -i -e "s#$olddir#$newdir#g" $(find target_* -name \*.la|xargs)
+	sed -i -e "s#$olddir#$newdir#g" $(find target_*/scripts -type f|xargs)
+	sed -i -e "s#$olddir#$newdir#" target_*/etc/ipkg.conf
+	sed -i -e "s#$olddir#$newdir#" prereq.mk
+fi