-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgithub_repo_new
executable file
·55 lines (43 loc) · 1.02 KB
/
github_repo_new
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
#!/bin/sh
THIS_SCRIPT=`realpath $0`
THIS_SCRIPT_DIR=`dirname ${THIS_SCRIPT}`
echo "THIS_SCRIPT_DIR: $THIS_SCRIPT_DIR"
BSDv2URL=https://raw.githubusercontent.com/freebsd/freebsd/master/share/examples/etc/bsd-style-copyright
REPOS_PATH=~/r
set -xe
if [ $# -ne 1 ]; then
echo "usage: github_repo_new <repo>"
exit;
fi
cd ${REPOS_PATH}
# sanity
#(cd cpu60 && git pull)
echo "Enter GitHub repo description"
read DESC
if [ ! -e ~/.licensehdr ]; then
echo "Enter your name + email (for the license file)"
read EMAIL
else
EMAIL=`cat ~/.licensehdr`
fi
if [ ! -e ~/.bsd-style-copyright ]; then
wget -O - $BSDv2URL | \
grep '^ \*' | \
cut -d " " -f 3- | \
grep -v "control system" > ~/.bsd-style-copyright
fi
mkdir $1
(
cd $1
git init
echo "# $DESC" > README.md
YEAR=`date '+%Y'`
cat ~/.bsd-style-copyright | \
sed "s,\[year\],$YEAR,g" | \
sed "s,\[your name\],$EMAIL,g" > LICENSE.md
git add README.md LICENSE.md
${THIS_SCRIPT_DIR}/git_author_start
git commit -m "$DESC"
hub create -p -d "$DESC"
git push -u origin main
)