script to make new modules

 
Post new topic   Reply to topic    Lunar-Linux Forum Index -> Module Development
View previous topic :: View next topic  
Author Message
ElAngelo



Joined: 10 Aug 2005
Posts: 77

PostPosted: Wed Jan 11, 2006 8:55 am    Post subject: script to make new modules Reply with quote

As building modules is sometimes boring (especially building the DETAILS file), i'm working on a interactive script that creates at least the DETAILS file for me Smile

this is not finished yet
only try if you want to code yourself a bit

Code:

#!/bin/bash

USER=`whoami`
if [ $USER = "root" ]
then
  echo "you want to create this module in zlocal? y/n"
  read ANSWER
  case "$ANSWER" in
    y )
    cd /var/lib/lunar/moonbase/zlocal
    ;;
    n )
    echo "module will be build in current directory"
    echo "testing will be impossible"
    ;;
  esac
else
  echo "module will be build in current directory"
  echo "testing will be impossible"
  echo "if you want to enable testing you should run this script as root"
fi



echo "name of new module?"
read MODULE
echo "new module is: $MODULE"
mkdir $MODULE
cd $MODULE
touch DETAILS
echo "           MODULE=$MODULE" >> DETAILS

echo "version?"
read VERSION
echo "version of the module is: $VERSION"
echo "          VERSION=$VERSION" >> DETAILS

echo "source name, choose option by number"
echo "1. $MODULE-$VERSION.tar.gz"
echo "2. $MODULE-$VERSION.tar.bz2"
echo "3. $MODULE"_"$VERSION.tar.gz"
echo "4. $MODULE"_"$VERSION.tar.bz2"
echo "5. other"

read SOURCE_TYPE

case "$SOURCE_TYPE" in
  1 )
  echo "           SOURCE=\$MODULE-\$VERSION.tar.gz" >> DETAILS
  SOURCE=$MODULE-$VERSION.tar.gz
  ;;
  2 )
  echo "           SOURCE=\$MODULE-\$VERSION.tar.bz2" >> DETAILS
  SOURCE=$MODULE-$VERSION.tar.bz2
  ;;
  3 )
  echo "           SOURCE=\$MODULE_\$VERSION.tar.gz" >> DETAILS
  SOURCE=$MODULE_$VERSION.tar.gz
  ;;
  4 )
  echo "           SOURCE=\$MODULE_\$VERSION.tar.bz2z" >> DETAILS
  SOURCE=$MODULE_$VERSION.tar.bz2
  ;;
  5 )
  echo "please provide the full source filename"
  read SOURCE
  echo "           SOURCE=$SOURCE" >> DETAILS
  ;;
esac
Back to top
View user's profile Send private message
sofar



Joined: 11 Aug 2005
Posts: 172

PostPosted: Thu Jan 12, 2006 7:17 pm    Post subject: bug Reply with quote

Code:
SOURCE=$MODULE_$VERSION.tar.gz


this is wrong, since bash things you are referring to $MOUDULE_ and not $MODULE (note the trailing underscore is a VALID character for a module)

use:

Code:
SOURCE=${MODULE}_$VERSION.tar.gz


instead
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Lunar-Linux Forum Index -> Module Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group