-
Notifications
You must be signed in to change notification settings - Fork 0
/
baby-cygwin.sh
executable file
·92 lines (77 loc) · 1.82 KB
/
baby-cygwin.sh
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
# baby cygwin
warn () {
printf '\e[36m%s\e[m\n' "$*"
}
log () {
unset PS4
qq=$(( set -x
: "$@" )2>&1)
warn "${qq:2}"
eval "${qq:2}"
}
set "$PWD"
mkdir baby-cygwin
cd baby-cygwin
# /
echo 'bin/bash -l' > cygwin.ps1
chmod +x cygwin.ps1
DATE=$(date)
CYGWIN_VERSION=$(uname -r | sed 's/(.*//')
u2d > README.txt <<bb
Baby Cygwin by Steven Penny
Steven’s Home Page: http://svnpenn.github.io
Today’s date $DATE
The build script for this build can be found at
http://github.com/svnpenn/a
Included with this package
Cygwin $CYGWIN_VERSION
OPERATING INSTRUCTIONS
Put any scripts into /usr/local/bin
Right click cygwin.ps1
bb
# /dev
mkdir dev
# /etc
mkdir etc
cd etc
cat > profile <<'bb'
PATH=/usr/bin:/usr/local/bin:$PATH
PS1='\e];\a\n\e[33m\w\n\e[m$ '
if ! [ -a /etc/passwd ]
then
mkpasswd > /etc/passwd
cygstart bash
kill -7 $$
fi
[ -d ~ ] || mkdir -p ~
[ -a ~/.bash_history ] || echo cd > ~/.bash_history
[ -a /bin/awk ] || ln -s /bin/gawk /bin/awk
[ -a /dev/fd ] || ln -s /proc/self/fd /dev/fd
cd
bb
cd -
# /usr/bin
deps=(
/bin/bash /bin/cat /bin/chmod /bin/cp /bin/cut /bin/date
/bin/diff /bin/dirname /bin/du /bin/dumper /bin/expr /bin/find
/bin/gawk /bin/grep /bin/ln /bin/ls /bin/mkdir /bin/mkpasswd
/bin/mount /bin/mv /bin/printf /bin/ps /bin/rm /bin/rmdir
/bin/sed /bin/sh /bin/sleep /bin/sort /bin/stat /bin/tee
/bin/tr /bin/uname /bin/uniq /bin/wget /bin/xargs
)
mkdir bin
cd bin
cp ${deps[*]} .
ldd ${deps[*]} | awk '/usr/ && ! aa[$0]++ {print $3}' | xargs cp -t.
cd -
# /usr/local/bin
mkdir -p usr/local/bin
# /usr/share/terminfo
mkdir -p usr/share
cd usr/share
cp -r /usr/share/terminfo .
# archive
cd ${0%/*}
BABY_VERSION=$(git log --follow --oneline $0 | wc -l)
cd "$1"
log zip -9mqr baby-cygwin-${BABY_VERSION}.zip baby-cygwin