forked from sihorton/tiny-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit
executable file
·107 lines (86 loc) · 2.3 KB
/
submit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh
. /usr/local/lib/tcztools/aliases
. /usr/local/lib/tcztools/die
. /usr/local/lib/tcztools/config
#this is a modified submit script so email is not actually sent.
usage() {
[ "$@" ] && error "$@"
say "\
Submit tcz extensions created with tcz-pack to the Tiny Core team.
v1.0 | Cosmin Apreutesei | tcztools.googlecode.com | MIT License
Usage: $@ [-y|--yes] [-q|--quiet] [--debug] <name1> ...
"
exit 1
}
while [ $# -gt 0 ]; do
case "$1" in
--yes | -y) YES=$1 ;;
--quiet | -q) QUIET=$1 ;;
--debug) DEBUG=$1 ;;
--help) usage ;;
-*) usage "Unknown option $1" ;;
*) break ;;
esac
shift
done
[ "$1" ] && names="$*" || usage
tmp=/tmp/tcztools
pack() {
name="$1"
local dst
dst=release/$name.submit
say -n "Packing $name.tcz..."
must rm -rf $dst
must mkdir -p $dst
must ln -s "$PWD"/$name.tcz.info $dst
must ln -s $tmp/$name.tcz.list $dst
must ln -s $tmp/$name.tcz $dst
must ln -s $tmp/$name.tcz.md5.txt $dst
[ ! -f $name.tcz.dep ] || must ln -s "$PWD"/$name.tcz.dep $dst
(cd $dst; must tar zcfh $tmp/$name.tar.gz .) || die "tar failed"
echo -e "tinycore\ntinycore\n" | must bcrypt -r $tmp/$name.tar.gz 2>/dev/null || die "bcrypt failed"
say "OK"
}
for name in $names; do
pack $name || die "packing $name.tcz failed"
done
contents() {
for name in $names; do
echo -e "$(du -h $tmp/$name.tar.gz.bfe | cut -f1)\t$name.tar.gz.bfe"
ls -1 $tmp/$name.submit | while read line; do echo -e "\t\t$line"; done
done
}
tmpfile="release/email.txt"
subject="[tcz-submit] $names"
echo "\
To:$submit_email
Subject:$subject
Hi,
Just packed some new extensions.
Here's what they're about:
$(contents)
Please upload them to the repo.
Thanks,
$author
$author_email
" > "$tmpfile"
if [ "$edit_email_before_sending" == "no" ]; then
say "An email will be sent to $submit_email with the message:"
say "Subject: $subject"
say "$(cat $tmpfile)"
say "----"
say "TIP: To edit the message before sending, add edit_email_before_sending=yes in $CONF"
hold
else
editor "$tmpfile"
say "An email will be sent to $submit_email with the message you just edited."
hold
fi
for name in $names; do
echo -a /tmp/tcztools/$name.tar.gz.bfe
cp /tmp/tcztools/$name.tar.gz.bfe release/$name.tar.gz.bfe
done
#say -n "Emailing to $submit_email..."
#cat "$tmpfile" | must mutt $(attachments) -s "$subject" $submit_email -c $author_email || die "mutt failed"
#run rm "$tmpfile"
#say "Done"