1 | #!/bin/bash |
---|
2 | |
---|
3 | set -e |
---|
4 | |
---|
5 | CAT="$1" |
---|
6 | NAME="$2" |
---|
7 | URL="$3" |
---|
8 | |
---|
9 | if ! [ "$URL" ]; then |
---|
10 | echo "Usage:" |
---|
11 | echo " $0 <category> <name> <url>"; |
---|
12 | echo " Imports slackware package from specified slackware source url" |
---|
13 | echo "Example:" |
---|
14 | echo " $0 system gmp 'http://mirrors.slackware.com/slackware/slackware-current/source/l/gmp/'" |
---|
15 | exit 1 |
---|
16 | fi |
---|
17 | |
---|
18 | mkdir $CAT/$NAME |
---|
19 | cd $CAT/$NAME |
---|
20 | |
---|
21 | #download and strip |
---|
22 | DIRS=`echo "$URL"|sed 's@.*//[^/]*@@'|sed 's@/@\n@g'|wc -l` |
---|
23 | (( DIRS=DIRS-2 )) |
---|
24 | |
---|
25 | |
---|
26 | wget --no-host-directories --cut-dirs=$DIRS --no-parent -e robots=off --reject '*md5' --reject 'index.html*' --reject '*sha1' --reject '*sha256' --reject '*meta4' --reject '*mirrorlist' --mirror "$URL"/ |
---|
27 | #find -name 'index.html*' -exec rm "{}" \; |
---|
28 | #find -name '*md5' -exec rm "{}" \; |
---|
29 | #find -name '*sha1' -exec rm "{}" \; |
---|
30 | #f#ind -name '*sha256' -exec rm "{}" \; |
---|
31 | #f#ind -name '*meta4' -exec rm "{}" \; |
---|
32 | #find -name '*mirrorlist' -exec rm "{}" \; |
---|
33 | |
---|
34 | #create syn3 slackbuild wrapper |
---|
35 | for SB in *.SlackBuild; do |
---|
36 | |
---|
37 | echo "Adding SYN-3 packaging to $SB ..." |
---|
38 | |
---|
39 | mv $SB $SB.orig |
---|
40 | |
---|
41 | SB_CLEAN=`echo $SB | sed 's/-/_/g'` |
---|
42 | |
---|
43 | #header with metainfo |
---|
44 | cat >> $SB_CLEAN <<-EOF |
---|
45 | #!/bin/bash |
---|
46 | # |
---|
47 | # Automaticly created by importpackage v1.0 |
---|
48 | # Imported from: $URL |
---|
49 | # Created at `date` |
---|
50 | |
---|
51 | |
---|
52 | ########### source original slackbuild (hopefully we dont need to modify it) |
---|
53 | CWD=\`pwd\` |
---|
54 | set -e |
---|
55 | source ./$SB.orig |
---|
56 | |
---|
57 | EOF |
---|
58 | |
---|
59 | #actual script stuff (quoted) |
---|
60 | cat >> $SB_CLEAN <<-"EOF" |
---|
61 | |
---|
62 | ############ make syn3 packages |
---|
63 | cd $CWD |
---|
64 | for PKG in /tmp/package-*; do |
---|
65 | NAME=`echo $PKG| sed 's/.*package-//'| sed 's/-/_/g'` |
---|
66 | |
---|
67 | #seperate dev-package |
---|
68 | syn3_move_dev $PKG $PKG""_dev |
---|
69 | syn3_makepkg $PKG""_dev $NAME""_dev $VERSION $ARCH || exit 1 |
---|
70 | |
---|
71 | #make main package |
---|
72 | syn3_makepkg $PKG $NAME $VERSION $ARCH || exit 1 |
---|
73 | done |
---|
74 | EOF |
---|
75 | |
---|
76 | chmod +x $SB_CLEAN $SB.orig |
---|
77 | |
---|
78 | done |
---|
79 | |
---|
80 | echo "Building package..." |
---|
81 | cd ../.. |
---|
82 | rm -rf .tmp |
---|
83 | ./rebuildcheck $NAME '' nopkgcheck |
---|
84 | |
---|
85 | |
---|