-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmyprofile
executable file
·197 lines (178 loc) · 5.26 KB
/
myprofile
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
####################### myprofile #########################################
#
# Copyright 2018, 2022 J. E. Garrott Sr, Puyallup, WA, USA
# Copyright 2018, 2022 "nobodino", Bordeaux, FRANCE
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#--------------------------------------------------------------------------
#
# myprofile
#
# This script creates several files under /etc
#
# Above july 2018, revisions made through github project:
# https://github.com/nobodino/slackware-from-scratch
#
#
#*********************************************************
# set -xv
#*********************************************************
# personal settings to be adjusted to your own convenients
#*********************************************************
generate_etc_fstab () {
#*******************************************************************
mkdir -pv "$SFS"/etc
cat > "$SFS"/etc/fstab << "EOF"
/dev/sdc2 swap swap defaults 0 0
/dev/sdc13 / ext4 defaults,noatime,discard 1 1
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs nosuid,nodev,noexec 0 0
# End /fstab
EOF
}
localtime () {
#***************************************************
cp /usr/share/zoneinfo/Europe/Paris /etc/localtime
}
resolv_conf () {
#***************************************************
cat > /etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf
search free.fr
nameserver 192.168.11.100
# End /etc/resolv.conf
EOF
}
ntp_conf () {
#***************************************************
cat > /etc/ntp.conf << "EOF"
# Begin /etc/ntp.conf
# /etc/ntp.conf
driftfile /etc/ntp/drift
logfile /var/log/ntp.log
server 0.fr.pool.ntp.org
server 1.fr.pool.ntp.org
server 2.fr.pool.ntp.org
server 3.fr.pool.ntp.org
server 192.168.2.1
server 127.127.1.0
fudge 127.127.1.0 stratum 10
restrict default ignore
restrict 127.0.0.1 mask 255.0.0.0
restrict 192.168.2.1 mask 255.255.255.255
statsdir /var/log/ntp/
statistics loopstats
filegen loopstats file loops type day link enable
# End /etc/ntp.conf
EOF
}
sync_clock () {
#***************************************************
cat > /root/scripts/SyncClock.sh << "EOF"
#!/bin/sh
echo "Clock is syncing to NTP, please wait..."
sudo /usr/sbin/ntpdate 0.pool.ntp.org
sudo /sbin/hwclock --systohc
EOF
}
rc_keymap () {
#***************************************************
cat > /etc/rc.d/rc.keymap << "EOF"
#!/bin/sh
# Load the keyboard map. More maps are in /usr/share/kbd/keymaps.
if [ -x /usr/bin/loadkeys ]; then
/usr/bin/loadkeys fr-latin9.map
fi
EOF
chmod +x /etc/rc.d/rc.keymap
}
root_profile () {
#***************************************************
cat > /root/.profile << "EOF"
#!/bin/sh
setxkbmap -model pc104 -layout fr
TZ='Europe/Paris' ; export TZ
export TERM=xterm
# Disable the QtWebEngine's sandbox to make Konqueror and Falkon to work as root.
export QTWEBENGINE_DISABLE_SANDBOX=1
EOF
}
root_bashrc () {
#***************************************************
cat > /root/.bashrc << "EOF"
#!/bin/sh
set -o vi
source /etc/profile
source /root/.profile
LANGUAGE=fr_FR.UTF-8
LC_MESSAGES=fr_FR.UTF-8
LC_ALL=fr_FR.UTF-8
LANG=fr_FR.UTF-8
LESSCHARSET=latin1
export LC_CTYPE LANGUAGE LC_MESSAGES LC_ALL LANG LESSCHARSET
alias q="cd .."
alias ll="ls --color=auto -a -N -l"
alias d="ls --color=auto -a -N"
alias indent="indent -kr"
EOF
}
root_vimrc () {
#***************************************************
cat > /root/.vimrc << "EOF"
" Begin /etc/vimrc
set nocompatible
set backspace=2
set tabstop=4
syntax on
set background=dark
endif
" End /root/.vimrc
EOF
}
#************************************************************
# end of personal settings
#************************************************************
generate_etc_fstab
localtime
resolv_conf
ntp_conf
touch /etc/rc.d/rc.ntpd
chmod +x /etc/rc.d/rc.ntpd
touch /var/log/ntp
chown ntp /var/log/ntp
mkdir -pv /root/scripts
sync_clock
chmod +x /root/scripts/SyncClock.sh
rc_keymap
root_profile
root_bashrc
root_vimrc
#**********************************
cat >> /etc/profile << "EOF"
# export LANG=fr_FR.UTF8
EOF
#**********************************
echo
echo "passwd: change password for root."
echo "Exit, and umount every thing."
echo