Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.

Commit 85eacf9

Browse files
authored
Merge pull request #13 from Linux4Yourself/release/v.1.0
Release/v.1.0
2 parents 1692041 + bf5d61b commit 85eacf9

20 files changed

+842
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# Linux4Yourself.Book.Scripts
1+
# Linux4Yourself.Book.Scripts
2+
3+
В данный репозиторий вынесены большие скрипты из книги

src/bashrc.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
cat > /etc/bashrc << "EOF"
2+
# Begin /etc/bashrc
3+
# Written for Beyond Linux From Scratch
4+
# by James Robertson <jameswrobertson@earthlink.net>
5+
# updated by Bruce Dubbs <bdubbs@linuxfromscratch.org>
6+
7+
# System wide aliases and functions.
8+
9+
# System wide environment variables and startup programs should go into
10+
# /etc/profile. Personal environment variables and startup programs
11+
# should go into ~/.bash_profile. Personal aliases and functions should
12+
# go into ~/.bashrc
13+
14+
# Provides colored /bin/ls and /bin/grep commands. Used in conjunction
15+
# with code in /etc/profile.
16+
17+
alias ls='ls --color=auto'
18+
alias grep='grep --color=auto'
19+
20+
# Provides prompt for non-login shells, specifically shells started
21+
# in the X environment. [Review the LFS archive thread titled
22+
# PS1 Environment Variable for a great case study behind this script
23+
# addendum.]
24+
25+
NORMAL="\[\e[0m\]"
26+
RED="\[\e[1;31m\]"
27+
GREEN="\[\e[1;32m\]"
28+
if [[ $EUID == 0 ]] ; then
29+
PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
30+
else
31+
PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
32+
fi
33+
34+
unset RED GREEN NORMAL
35+
36+
# End /etc/bashrc
37+
EOF

src/chroot-exit.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
umount $LIN/dev{/pts,}
2+
umount $LIN/{sys,proc,run}

src/chroot.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
chroot "$LIN" /usr/bin/env -i \
2+
HOME=/root TERM="$TERM" \
3+
PS1='(chroot) \u:\w\$ ' \
4+
PATH=/usr/bin \
5+
/bin/bash --login

src/completion.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
cat > /etc/profile.d/bash_completion.sh << "EOF"
2+
# Begin /etc/profile.d/bash_completion.sh
3+
# Import bash completion scripts
4+
5+
# If the bash-completion package is installed, use its configuration instead
6+
if [ -f /usr/share/bash-completion/bash_completion ]; then
7+
8+
# Check for interactive bash and that we haven't already been sourced.
9+
if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then
10+
11+
# Check for recent enough version of bash.
12+
if [ ${BASH_VERSINFO[0]} -gt 4 ] || \
13+
[ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; then
14+
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
15+
. "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
16+
if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then
17+
# Source completion code.
18+
. /usr/share/bash-completion/bash_completion
19+
fi
20+
fi
21+
fi
22+
23+
else
24+
25+
# bash-completions are not installed, use only bash completion directory
26+
if shopt -q progcomp; then
27+
for script in /etc/bash_completion.d/* ; do
28+
if [ -r $script ] ; then
29+
. $script
30+
fi
31+
done
32+
fi
33+
fi
34+
35+
# End /etc/profile.d/bash_completion.sh
36+
EOF
37+
install --directory --mode=0755 --owner=root --group=root /etc/bash_completion.d

src/dircolors.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cat > /etc/profile.d/dircolors.sh << "EOF"
2+
# Setup for /bin/ls and /bin/grep to support color, the alias is in /etc/bashrc.
3+
if [ -f "/etc/dircolors" ] ; then
4+
eval $(dircolors -b /etc/dircolors)
5+
fi
6+
7+
if [ -f "$HOME/.dircolors" ] ; then
8+
eval $(dircolors -b $HOME/.dircolors)
9+
fi
10+
11+
alias ls='ls --color=auto'
12+
alias grep='grep --color=auto'
13+
EOF
14+
dircolors -p > /etc/dircolors

src/etc-inputrc.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
cat > /etc/inputrc << "EOF"
2+
# Begin /etc/inputrc
3+
# Modified by Chris Lynn <roryo@roryo.dynup.net>
4+
5+
# Allow the command prompt to wrap to the next line
6+
set horizontal-scroll-mode Off
7+
8+
# Enable 8bit input
9+
set meta-flag On
10+
set input-meta On
11+
12+
# Turns off 8th bit stripping
13+
set convert-meta Off
14+
15+
# Keep the 8th bit for display
16+
set output-meta On
17+
18+
# none, visible or audible
19+
set bell-style none
20+
21+
# All of the following map the escape sequence of the value
22+
# contained in the 1st argument to the readline specific functions
23+
"\eOd": backward-word
24+
"\eOc": forward-word
25+
26+
# for linux console
27+
"\e[1~": beginning-of-line
28+
"\e[4~": end-of-line
29+
"\e[5~": beginning-of-history
30+
"\e[6~": end-of-history
31+
"\e[3~": delete-char
32+
"\e[2~": quoted-insert
33+
34+
# for xterm
35+
"\eOH": beginning-of-line
36+
"\eOF": end-of-line
37+
38+
# for Konsole
39+
"\e[H": beginning-of-line
40+
"\e[F": end-of-line
41+
42+
# End /etc/inputrc
43+
EOF

src/file-system.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
mkdir -pv $LIN/{usr,etc,var,lib64}
2+
mkdir -pv $LIN/{boot,home,mnt,opt,srv}
3+
mkdir -pv $LIN/usr/{,local/}{bin,include,lib,src}
4+
mkdir -pv $LIN/{dev,proc,sys,run}
5+
6+
ln -sfv usr/bin $LIN/bin
7+
ln -sfv usr/lib $LIN/lib
8+
ln -sfv usr/bin $LIN/sbin
9+
ln -sfv bin $LIN/usr/sbin
10+
11+
mkdir -pv $LIN/etc/{opt,sysconfig}
12+
mkdir -pv $LIN/lib/firmware
13+
mkdir -pv $LIN/media/{floppy,cdrom}
14+
mkdir -pv $LIN/usr/{,local/}share/{color,dict,doc,info,locale,man}
15+
mkdir -pv $LIN/usr/{,local/}share/{misc,terminfo,zoneinfo}
16+
mkdir -pv $LIN/usr/{,local/}share/man/man{1..8}
17+
mkdir -pv $LIN/var/{cache,local,log,mail,opt,spool}
18+
mkdir -pv $LIN/var/lib/{color,misc,locate}
19+
20+
ln -sfv /run $LIN/var/run
21+
ln -sfv /run/lock $LIN/var/lock
22+
23+
install -dv -m 0750 $LIN/root
24+
install -dv -m 1777 $LIN/tmp $LIN/var/tmp

src/fstab.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cat > /etc/fstab << "EOF"
2+
# file system mount-point type options dump fsck
3+
# order
4+
5+
6+
/dev/sdX / ext4 defaults 1 1
7+
EOF

src/inputrc.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cat > /etc/profile.d/readline.sh << "EOF"
2+
# Setup the INPUTRC environment variable.
3+
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then
4+
INPUTRC=/etc/inputrc
5+
fi
6+
export INPUTRC
7+
EOF

0 commit comments

Comments
 (0)