From 6df97385b2af0423963b3eb159b0b504b9fc3e0e Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Fri, 5 Feb 2016 13:34:03 +0100 Subject: add kernel configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are moved from meta-enea-base Signed-off-by: Adrian Dudau Signed-off-by: Nora Björklund --- recipes-kernel/linux/files/cfg/indexcfgs.pl | 167 ++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100755 recipes-kernel/linux/files/cfg/indexcfgs.pl (limited to 'recipes-kernel/linux/files/cfg/indexcfgs.pl') diff --git a/recipes-kernel/linux/files/cfg/indexcfgs.pl b/recipes-kernel/linux/files/cfg/indexcfgs.pl new file mode 100755 index 0000000..96cd78a --- /dev/null +++ b/recipes-kernel/linux/files/cfg/indexcfgs.pl @@ -0,0 +1,167 @@ +#!/usr/bin/perl -w +#---------------------------------------------------------------------- +# indexcfgs.pl - utility to rename files in the current directory to an +# indexed format so that a unique index number is +# prepended to the current file name. The naming +# template is: +# +# DDDDD- +# +# Usage: create the *.cfg file you need, with any name and .cfg +# extension. Run this script and it will automatically +# rename your file to the indexed format above. +# +# Author: Daniel BORNAZ $max_index){ + $max_index=$crt_index; + } + + $counter_indexed++; + }else{ + @queue=($file,@queue); + $counter_queue++; + } + } + +# set the next index number + $max_index++; + +# index the enqueued file names + foreach my $file (@queue){ + my $newname; + + $newname=sprintf("%05d-%s",$max_index++,$file); + system("mv",$file,$newname) == 0 + or die "Cannot rename $file to $newname: $?"; + } + + printf("$counter_queue files indexed, ". + "$counter_indexed files already indexed. Done.\n"); +} + +#-------------------------------------------------------------------- +# display usage help +# +sub print_usage { + print "\n"; + print " ./indexcfgs.pl [--strip]\n"; + print " no params: Index the *.cfg file names in current dir\n"; + print " to DDDDD-\n"; + print " --strip: Strips the index from the *.cfg file names ". + "in current dir\n"; + print "\n"; + + exit 0; +} + + +#--- Program starts here -------------------------------------------- +GetOptions(\%args, + "strip" => \$opt_strip, + "help" => \$opt_help, +); + +if(defined($opt_help)){ + print_usage(); +} + +if(defined($opt_strip)){ + strip_file_names(); +}else{ + index_file_names(); +} + + -- cgit v1.2.3-54-g00ecf