1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/bin/bash
- if [[ "$1" != "" ]];then
- btype="";
- script="";
- if [[ "$2" != "" ]];then
- mkdir -p src/$1;
- ln -s `readlink -f $2` src/$1/source;
- echo "Linked source in $2";
- else
- mkdir -p src/$1/source;
- fi;
- mkdir -p src/$1/pkg
- mkdir -p src/$1/src
- if [[ ! -f src/$1/PKGBUILD ]];then
- cp etc/PKGBUILD.in src/$1/PKGBUILD;
- echo -e "pkgname=$1\n"|cat - src/$1/PKGBUILD > /tmp/out && mv /tmp/out src/$1/PKGBUILD;
- fi;
- if [[ ! -f src/$1/build.sh ]];then
- cp etc/build.sh.in src/$1/build.sh
- fi;
- chmod +x src/$1/build.sh
- echo -e "Type:\n (1) script\n (2) git\n (3) svn";
- while [[ ! $btype =~ ^1|2|3$ ]]; do
- read btype;
- done;
- case $btype in
- 2)
- btype="git";
- ;;
- 3)
- btype="svn";
- ;;
- *)
- btype="script";
- read -p "Script path: " script;
- ;;
- esac;
- file=`dirname $BASH_SOURCE`/../etc/packages.d/$1;
- touch $file;
- echo "packages+=(\"[name]='$1' [type]='$btype' [script]='$script'\")" > $file;
- echo "Created project $1";
- else
- echo "Usage: $0 <package> [<sourcedir>]";
- fi;
|