scripts/feeds: Reuse TOPDIR if defined in environment
[openwrt/openwrt.git] / scripts / feeds
index 83007f5e167e21edd3a84123f3d3b630c004ec07..dfecaa9bb65222d116d4be71c2d32ffe55011ed2 100755 (executable)
@@ -9,7 +9,8 @@ use strict;
 use Cwd 'abs_path';
 
 chdir "$FindBin::Bin/..";
-$ENV{TOPDIR}=getcwd();
+$ENV{TOPDIR} //= getcwd();
+chdir $ENV{TOPDIR};
 $ENV{GIT_CONFIG_PARAMETERS}="'core.autocrlf=false'";
 $ENV{GREP_OPTIONS}="";