aboutsummaryrefslogtreecommitdiff
path: root/mll-linuxgraphy-setup.sh
blob: c13e524ddd98faee28a54e7dc463c81c8ed87cb5 (plain) (blame)
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
#!/bin/sh

# ================================================================================
# This is a setup script for all utilities I need for the talk (presentation)
# https://syndamia.com/talks/linuxgraphy-by-strabo/
#
# Note that all of this can be done with a proper bundle and rebuild, but I'm lazy
# ================================================================================

#
# prerequisites
#
mkdir /tmp/linuxography-setup/
cd /tmp/linuxography-setup/

#
# package installation (all done in /usr/local)
#
mkdir /usr/local/
export PATH=$PATH:/usr/local/sbin:/usr/local/bin

# bash
wget -q http://s.minos.io/archive/bifrost/x86_64/bash-4.4-1.tar.xz
tar xf bash-4.4-1.tar.xz

# coreutils
wget -q http://s.minos.io/archive/bifrost/x86_64/coreutils-7.6-5.tar.xz
tar xf coreutils-7.6-5.tar.xz

# shadow
wget -q http://s.minos.io/archive/bifrost/x86_64/shadow-4.1.4.2-1.tar.xz
tar xf shadow-4.1.4.2-1.tar.xz

mv ./bin/ /usr/local/bin/
mv ./usr/sbin/ /usr/local/sbin/  # shadow
mv ./usr/bin/* /usr/local/bin/   # shadow

#
# file setup
#
tee /etc/passwd << EOF >/dev/null
root:x:0:0:root:/root:/bin/sh
bin:x:1:1:bin:/bin:/bin/false
daemon:x:2:2:daemon:/sbin:/bin/false
adm:x:3:4:adm:/var/adm:/bin/false
lp:x:4:7:lp:/var/spool/lpd:/bin/false
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
nobody:x:65534:65534::/dev/null:/bin/false
EOF

tee /etc/bashrc << EOF >/dev/null
# Prompt to the left of cursor
export PS1='[\u] j:\j e:$? \w \$ '

# UpArrow autocompletes partial history
bind '"\e[A":history-search-backward'
# DownArrow autocompletes partial history
bind '"\e[B":history-search-forward'

# Ctrl+RightArrow jumps to next word
bind '"\e[1;5C":forward-word'
# Ctrl+LeftArrow jumps to predvious word
bind '"\e[1;5D":backward-word'

# Ctrl+BackSpace deletes an entire word
bind '"\C-h":backward-kill-word'

clear
cat /etc/motd
EOF

tee /etc/profile << EOF >/dev/null
export PATH=$PATH
source /etc/bashrc
EOF

#
# finalize
#
echo "Done!"
cd /
bash -l