> I would be very interested if you knew why the absolute path
> (home-marco-linux_2.6.24-8.13-ubuntu-hardy-) has been added.
The reason why is the trailing slash in the first sed filter does not
match Marco's path:
RELATIVE_PATH=$(echo $ABSOLUTE_PATH | sed -e "s/^.*$LINUX_FOLDER_NAME//" | sed
-e "s/\//--/g")
I tried your script, got some nice output, and learned some cool stuff.
Attached is the script with modifications that you might like:
1. Error check that exits and complains if faced with above problem.
2. Much faster command to count files (lightly tested!).
3. Minor changes to a variable name and some comments. $DRIVER_NAME
seems too specific since your script works on the entire kernel tree,
not just for drivers.
Lastly, at some point you might consider adding a simple copyright notice.
#!/bin/bash
# Usage:
# cd to directory of kernel files you are currently working on.
# $ ./PathToTableFormat.sh/TableFormat.sh > MyOutputFile
#
# Don't copy the script in the directory you're working on, the calculation would include
# the 'TableFormat.sh' file which is not part of the Kernel
#
# You can then copy and paste from the MyOutputFile file to the wiki page. Don't forget to
# delete it after use !
#
# Note:
# [1] If the script is located in the current directory, it will create an entry for it. This
# should be deleted.
# [2] Before you run this script, be sure to update all the required variables
##### Those variables may require updates #####
LINUX_FOLDER_NAME="linux-2.6.24"
NAME="NEEDS ADOPTING" #if adopted by lee797, replace "NEEDS ADOPTING" with [[~lee797]]
DATE="?" #if today, replace "?" with $(date +"%d %b %y")
#if adopted earlier than today, replace "?" with, say,
#"18 Feb 08"
##### Those variables shouldn't require updates #####
LINUX_VERSION=$(echo $LINUX_FOLDER_NAME | sed -e "s/linux-//" | sed -e "s/\./-/g")
ABSOLUTE_PATH=$(pwd)
RELATIVE_PATH=$(echo $ABSOLUTE_PATH | sed -e "s/^.*$LINUX_FOLDER_NAME//" | sed -e "s/\//--/g")
#Determine the children path of the folder $LINUX_FOLDER_NAME
#And replace '/' by '--' in this path
##### Error Checking
if [[ ! $ABSOLUTE_PATH =~ $LINUX_FOLDER_NAME\($\|/\) ]]; then
echo "ERROR: Current directory does not seem to be within a $LINUX_FOLDER_NAME kernel tree"
exit 1
fi
echo "|| border=1"
echo "||!Section||!Owner||!Date adopted (DD MMM YY)||!Total number of files in section (including README's etc.)||!Percentage of section completed||!Percentage of section certified free (updated weekly by section owner- include date (DD MMM YY)||!All suspected non-free software reported (Yes/ No or N/A if none to report)||!Date of summary (DD MMM YY)||"
for DIR_ENTRY in `ls`; do
NB_FILES=$(find $DIR_ENTRY -type f | wc -l) #count the files present in the current
#file or folder DIR_ENTRY recursively
NEW_DIR_ENTRY=$(echo $DIR_ENTRY | sed -e "s/[\.\_]/-/g") #Replace '.' and '_' by '-' in the name of $DIR_ENTRY
echo "||[[wiki:Kernel/Ubuntu-hardy-linux-"$LINUX_VERSION$RELATIVE_PATH"--"$NEW_DIR_ENTRY"|Ubuntu-hardy-"$DIR_ENTRY"]]||"$NAME"||"$DATE"||"$NB_FILES"||0%||0%||N/A||"$DATE"||"
done
exit 0
_______________________________________________
gNewSense-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/gnewsense-users