コード例 #1
0
ファイル: net.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print('network')

    with create_file(Path(config['path_to_root'], 'etc/conf.d/net')) as f:
        print('config_eth0="dhcp"', file=f)
        print('hostname="neo"', file=f)

    with create_file(Path(config['path_to_root'], 'etc/resolv.conf')) as f:
        print('nameserver 8.8.8.8', file=f)
コード例 #2
0
def configure(config):
    configure_print('mpv')
    path_to_mpv_dir = Path(config['path_to_root'], 'home', config['user_name'], '.config', 'mpv')

    with create_file(Path(path_to_mpv_dir, 'config')) as f:
        print("""##############################################################
# https://github.com/mpv-player/mpv/blob/master/DOCS/man/en/ #
##############################################################
ad-lavc-threads=2
vd-lavc-threads=8

cache=262144          # 256 mb
cache-default=262144  # 256 mb

reset-on-next-file=""

volume=50

sub-ass=no
osd-duration=3000
osd-font="Liberation Mono"
osd-font-size=12
osd-level=3 # volume + seek + timer + percentage + total time

osd-color=1.0/1.0/1.0
osd-back-color=0.0/0.0/0.0/0.25

osd-border-size=0
sub-text-blur=0

hwdec=auto

slang="ru"
alang="ru"

vo=opengl-hq

screenshot-jpeg-quality=100
screenshot-png-compression=9
""", file=f)

    with create_file(Path(path_to_mpv_dir, 'input.conf')) as f:
        print("""
F1 show_text "${filename}(${video-format})   [${width}x${height}@${fps} ${file-size}]"
F3 show_text "${estimated-frame-number} / ${estimated-frame-count}"
F3 show_text "video bitrate: ${video-bitrate}"
F4 show_text "cache total/used/free: ${cache-size} / ${cache-used} / ${cache-free} - ${cache}%"
""", file=f)
コード例 #3
0
ファイル: git.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print('git')
    path_to_mpv_dir = Path(config['path_to_root'], 'home', config['user_name'])

    with create_file(Path(path_to_mpv_dir, '.gitconfig')) as f:
        print("""[user]
name = Andrey Morozov
email = [email protected]

[core]
    editor = vim
    whitespace = -indent-with-non-tab,-space-before-tab,-trailing-space,-cr-at-eol
    autocrlf = true

[alias]
    s = status
    d = diff
    c = commit
    l = log --graph --pretty=format:'%C(red)%h%C(yellow)%d%Creset %s %C(white) [%C(green)%an:%Creset %ar]'
    ll = log --graph --branches --decorate --stat --all --abbrev-commit
    lll = log --graph --branches --decorate --stat --all --abbrev-commit -p
    co = checkout
    b = branch -vv 
    ba = branch -a -vv 
    up = fetch --all --prune --recurse-submodules=yes -j4 --progress
    report = shortlog --all --branches --no-merges -n --since=7.days.ago
    uncommit = reset HEAD~
    wd = show --stat -p # whatdiff

[color]
    ui = true
    interactive = auto

[color "branch"]
    current = yellow bold
    local = green bold
    remote = cyan bold

[color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
    whitespace = white reverse

[color "status"]
    added = green bold
    changed = yellow bold
    untracked = red bold

[github]
    user = AoD314

[http]
    postBuffer = 536870912

[filter "tabspace"]
    smudge = unexpand --tabs=4 --first-only
    clean = expand --tabs=4 --initial
""", file=f)
コード例 #4
0
ファイル: X.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print('X')
    path_to_home = Path(config['path_to_root'], 'home', config['user_name'])

    with create_file(Path(path_to_home, '.xinitrc')) as f:
        print("exec startkde", file=f)

    with create_file(Path(config['path_to_root'], 'etc/conf.d/xdm')) as f:
        print("""# We always try and start X on a static VT. The various DMs normally default
# to using VT7. If you wish to use the xdm init script, then you should ensure
# that the VT checked is the same VT your DM wants to use. We do this check to
# ensure that you haven't accidentally configured something to run on the VT
# in your /etc/inittab file so that you don't get a dead keyboard.
CHECKVT=7

# What display manager do you use ?  [ xdm | gdm | kdm | gpe | entrance ]
# NOTE: If this is set in /etc/rc.conf, that setting will override this one.
DISPLAYMANAGER="kdm"
""", file=f)
コード例 #5
0
def configure(config):
    configure_print('sysctl.conf')

    with create_file(Path(config['path_to_root'], 'etc/sysctl.conf')) as f:
        print("""
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1

vm.swappiness=0
""", file=f)
コード例 #6
0
ファイル: locale.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print('locale')

    with create_file(Path(config['path_to_root'], 'etc/locale.gen')) as f:
        print("""
ru_RU.UTF-8 UTF-8
en_US.UTF-8 UTF-8
""", file=f)

    with create_file(Path(config['path_to_root'], 'etc/environment')) as f:
        print("""
LANG="en_US.UTF-8"
""", file=f)

    with create_file(Path(config['path_to_root'], 'etc/conf.d/consolefont')) as f:
        print("""
consolefont="LatArCyrHeb-16"
""", file=f)

    with create_file(Path(config['path_to_root'], 'etc/conf.d/keymaps')) as f:
        print("""
keymap="us"
windowkeys="yes"
extended_keymaps=""
dumpkeys_charset=""
fix_euro="no"
""", file=f)

    with create_file(Path(config['path_to_root'], 'etc/conf.d/hwclock')) as f:
        print("""
clock="UTC"
clock_args=""
""", file=f)

    with create_file(Path(config['path_to_root'], 'etc/ntp.conf')) as f:
        print("""
# Common pool for random people
#server pool.ntp.org

server ntp1.stratum2.ru
server ntp2.stratum2.ru
server ntp3.stratum2.ru

server ntp1.stratum1.ru
server ntp2.stratum1.ru
server ntp3.stratum1.ru

# Pools for Gentoo users
server 0.gentoo.pool.ntp.org
server 1.gentoo.pool.ntp.org
server 2.gentoo.pool.ntp.org
server 3.gentoo.pool.ntp.org


driftfile       /var/lib/ntp/ntp.drift

restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1
restrict [::1]
""", file=f)
コード例 #7
0
ファイル: profile.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print("profile")

    with create_file(Path(config["path_to_root"], "etc/profile")) as f:
        print(
            """
export HISTSIZE=8192
export HISTFILESIZE=$HISTSIZE
export HISTIGNORE="&:ls:[bf]g:exit:l:ll:cd ..:m:n:pwd:[ \t]*"
export HISTCONTROL=ignorespace:erasedups
export EIX_LIMIT_COMPACT=0
export EIX_LIMIT=0
""",
            file=f,
        )
コード例 #8
0
ファイル: sublime.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print('sublime')

    with create_file(Path(config['path_to_root'], 'home', config['user_name'],'.config/sublime-text-2/Packages/User/Preferences.sublime-settings')) as f:
        print("""{
    "color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
    "font_face": "Hack",
    "font_size": 10,
    "translate_tabs_to_spaces": true,
    "tab_size": 4,
    "auto_complete_delay": 10,
    "rulers": [80, 120, 160],
    "highlight_modified_tabs": true,
    "draw_white_space": "all"
}
""", file=f)
コード例 #9
0
def configure(configuration):
    configure_print('make.conf')
    path_to_root = configuration['path_to_root']
    print('see ' + str(Path(path_to_root, 'usr/share/portage/config/make.conf.example')) + ' for examples')

    with create_file(Path(path_to_root, 'etc/portage/make.conf')) as f:
        sse = get_sse_support()
        py = get_python_support()
        cmd = sse + '\n\n' + '\n\n' + py + """
ACCEPT_LICENSE="*"
CFLAGS="-O2 -pipe -march=native"
CXXFLAGS="${CFLAGS}"

VIDEO_CARDS="nvidia"
INPUT_DEVICES="keyboard mouse" # virtualbox

CHOST="x86_64-pc-linux-gnu"

USE="nls theora gmp posix usb png threads \
     policykit consolekit utf8 \
     ipv6 lm_sensors -introspection"

USE="${USE} qt4 qt5 -gtk -gtk3 -wayland egl gles opengl "
USE="${USE} ffmpeg -libav -vlc "
USE="${USE} ogg xvid x264 webm vdpau flac "
USE="${USE} udev -systemd -eudev "
USE="${USE} -java -ruby "
USE="${USE} -sqlite -mysql "
USE="${USE} -pam -semantic-desktop "
USE="${USE} -pulseaudio alsa "

ALSA_CARDS="ca0106 hda-intel"

CHOST="x86_64-pc-linux-gnu"

PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages"
MAKEOPTS="-j{0}"
EMERGE_DEFAULT_OPTS="--jobs=2 --keep-going=y "
PORTAGE_TMPDIR=/tmp
PORTDIR_OVERLAY="/usr/local/portage"

source /var/lib/layman/make.conf
""".format(multiprocessing.cpu_count() + 1)
        print(cmd, file=f)
コード例 #10
0
def configure(config):
    configure_print('bash')
    user_name = config['user_name']
    path_to_home = Path(config['path_to_root'], 'home', user_name)

    with create_file(Path(path_to_home, '.bashrc')) as f:
        print("""

PS1='\[\e[1;32m\]\u \[\e[0;31m\] [\[\e[1;34m\]\w \[\e[1;32m\]$(__git_ps1 "(%s)")\[\e[0;31m\]] \[\e[1;37m\]{\t}\n\$ '

shopt -s histappend
PROMPT_COMMAND='history -a'
shopt -s cdspell
shopt -s dirspell

#export ANDROID_NDK=/opt/android-ndk/
#export ANDROID_STANDALONE_TOOLCHAIN=/opt/android-ndk/toolchains/
#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib64

PATH=$PATH:/opt/sublime-text2/

alias gr="grep -niIHR"
alias htop="htop -d 2"

alias l="ls -lh"
alias lS="ls -lSh"
alias ll="ls -lah"
alias bigs="ls -Shal | head -n 25"
alias news="ls -lsaht | head -n 25"
alias hotm="ps -A -o rssize:10,time:9,%cpu:5,cmd | sort -nr | head | awk '{ printf \"%7.1f M  --- %s\n\", \$1/1024, \$4}{};'"
alias hotc="ps -A -o rssize:10,time:9,%cpu:5,cmd --sort -%cpu | head -n 13 | awk '{ printf \"%6.1f%% --- %s\n\", \$3, \$4}{};' | tail -n 12"

alias m="make -j5"
alias n="ninja"
alias sl="sublime_text"

alias hddfree="du -h --max-depth=1 | sort -h"

source ~/.git-completion.bash

bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
""".format(user_name, str(256 * 1024 * 1024), str(multiprocessing.cpu_count() + 1)), file=f)
コード例 #11
0
ファイル: xkb.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print('sublime')

    with create_file(Path(config['path_to_root'], 'home', config['user_name'] ,'.config/qxkb.cfgs')) as f:
        print("""
[Style]
path=/usr/share/qxkb/theme/default

[KeyLayout]
model=pc104
layout="us,ru"
variant=" ,"
status=2
showflag=true
showsingle=false
switching=0
useConvert=false
shotcutConvert=
option=grp:caps_toggle
""", file=f)
コード例 #12
0
ファイル: sysctl.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print('sysctl.conf')

    with create_file(Path(config['path_to_root'], 'etc/sysctl.conf')) as f:
        print("""
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1

vm.dirty_bytes = 67108864
vm.dirty_background_bytes = 50331648

# Устанавливаем в 256 Кб размер буферов по умолчанию для приема и отправки данных через сокеты
net.core.rmem_default = 262144
net.core.wmem_default = 262144

# Устанавливаем в 16Мб максимальный размер буфера сокетов.
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216

# максимальное кол-во соединений
net.ipv4.tcp_max_orphans = 65536

net.ipv4.tcp_mem=65536 131072 262144
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216

net.ipv4.tcp_sack = 1
net.ipv4.tcp_no_metrics_save = 1

net.ipv4.tcp_fin_timeout = 10

# Максимальный размер очереди 
net.core.netdev_max_backlog = 2048

vm.swappiness=0
""", file=f)
コード例 #13
0
ファイル: bash.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print('bash')
    user_name = config['user_name']
    path_to_home = Path(config['path_to_root'], 'home', user_name)

    with create_file(Path(path_to_home, '.bashrc')) as f:
        print("""

PS1='\[\e[1;32m\]\u \[\e[0;31m\] [\[\e[1;34m\]\w \[\e[1;32m\]$(__git_ps1 "(%s)")\[\e[0;31m\]] \[\e[1;37m\]{\t}\n\$ '

function extract {
 if [ -z "$1" ]; then
    # display usage if no parameters given
    echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
 else
    if [ -f "$1" ] ; then
        NAME=${1%.*}
        #mkdir $NAME && cd $NAME
        case "$1" in
          *.tar.bz2)   tar xvjf ./"$1"    ;;  
          *.tar.gz)    tar xvzf ./"$1"    ;;  
          *.tar.xz)    tar xvJf ./"$1"    ;;  
          *.lzma)      unlzma ./"$1"      ;;  
          *.bz2)       bunzip2 ./"$1"     ;;  
          *.rar)       unrar x -ad ./"$1" ;;
          *.gz)        gunzip ./"$1"      ;;  
          *.tar)       tar xvf ./"$1"     ;;  
          *.tbz2)      tar xvjf ./"$1"    ;;  
          *.tgz)       tar xvzf ./"$1"    ;;  
          *.zip)       unzip ./"$1"       ;;  
          *.Z)         uncompress ./"$1"  ;;  
          *.7z)        7z x ./"$1"        ;;  
          *.xz)        unxz ./"$1"        ;;  
          *.exe)       cabextract ./"$1"  ;;  
          *)           echo "extract: '$1' - unknown archive method" ;;
        esac
    else
        echo "'$1' - file does not exist"
    fi  
fi
}

shopt -s histappend
PROMPT_COMMAND='history -a'
shopt -s cdspell
shopt -s dirspell

#export ANDROID_NDK=/opt/android-ndk/
#export ANDROID_STANDALONE_TOOLCHAIN=/opt/android-ndk/toolchains/
#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib64

PATH=$PATH:/opt/sublime-text2/

alias gr="grep -niIHR"
alias htop="htop -d 2"

alias l="ls -lh"
alias lS="ls -lSh"
alias ll="ls -lah"
alias bigs="ls -Shal | head -n 25"
alias news="ls -lsaht | head -n 25"
alias hotm="ps -A -o rssize:10,time:9,%cpu:5,cmd | sort -nr | head | awk '{ printf \"%7.1f M  --- %s\n\", \$1/1024, \$4}{};'"
alias hotc="ps -A -o rssize:10,time:9,%cpu:5,cmd --sort -%cpu | head -n 13 | awk '{ printf \"%6.1f%% --- %s\n\", \$3, \$4}{};' | tail -n 12"

alias m="make -j9"
alias n="ninja"
alias sl="sublime_text"

alias hddfree="du -h --max-depth=1 | sort -h"

source ~/.git-completion.bash

bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
""".format(user_name, str(256 * 1024 * 1024), str(multiprocessing.cpu_count() + 1)), file=f)
コード例 #14
0
ファイル: vim.py プロジェクト: AoD314/handbook-gentoo
def configure(config):
    configure_print('vim')
    path_to_root = config['path_to_root']
    user_name = config['user_name']

    with create_file(Path(path_to_root, 'home', user_name, '.vimrc')) as f:
        print("""set nu
set encoding=utf-8
set background=dark
colorscheme pablo
set completeopt=longest,menuone
nnoremap * *N
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smarttab
set expandtab
set pastetoggle=<F2>
set clipboard=unnamed
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
vnoremap < <gv
vnoremap > >gv
set hlsearch
set incsearch
set ignorecase
set smartcase
set nobackup
set nowritebackup
set noswapfile
set smartcase
set incsearch
set autowrite
set hidden
set laststatus=2
set statusline=%<%F%h%m%r%h%w%y\ %{&ff}\ %{strftime(\"%c\")}%=\ line:%l\/%L\ col:%c%V\ pos:%o\ ascii:%b\ %P
set hlsearch
if has("gui_running")
    if has("gui_gtk2")
        set guifont=Droid\ Sans\ Mono\ 11
    elseif has("gui_win32")
        set guifont=Consolas:h11:cANSI
    endif
    set lines=9999
    set columns=999
    set guioptions-=m
    set guioptions-=T
endif
set history=25000
set showcmd
set nocompatible
syntax on
set showmatch
set ignorecase
set showmode
set ts=4
set sw=4
imap <c-space> <c-x><c-o>
set backspace=2
filetype plugin on
filetype indent on
iab utf! # -*- coding: UTF-8 -*-
iab python! #!/usr/bin/env python
nmap <C-N> :noh <CR>
set incsearch
set hlsearch
set nocompatible
filetype on
filetype plugin on
filetype indent on
set ofu=syntaxcomplete#Complete
nnoremap <silent> <F8> :TlistToggle<CR>
set showtabline=1
nmap <S-Left> :tabprevious<CR>
imap <S-Left> :tabprevious<CR>
map  <S-Left> :tabprevious<CR>
nmap <S-Right> :tabnext<CR>
imap <S-Right> :tabnext<CR>
map  <S-Right> :tabnext<CR>
nnoremap <silent> <A-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
nnoremap <silent> <A-Right> :execute 'silent! tabmove ' . tabpagenr()<CR>
nmap <F3> :tab sp . <CR>
imap <F3> :tab sp . <CR>
map  <F3> :tab sp . <CR>
set fo-=ro
set foldenable
set foldlevel=25
set foldmethod=indent
set foldnestmax=2
nnoremap <space> za
vnoremap <space> zf
set t_Co=256
set udf
set nobackup
set nowritebackup
set noswapfile
""", file=f)
コード例 #15
0
ファイル: config.py プロジェクト: AoD314/handbook-gentoo
def configure_applications(config):
    print('clear ' + config['path_to_root'] + ' ...')
    subprocess.getstatusoutput('rm -rf ' + config['path_to_root'])
    print('unpacking stage3 ...')
    subprocess.getstatusoutput('tar xvjpf ' + config['path_to_stage3'] + ' -C ' + config['path_to_root'])
    print('unpacking portage ...')
    subprocess.getstatusoutput('tar xvjf  ' + config['path_to_portage'] + ' -C ' + str(Path(config['path_to_root'], 'usr')))

    profile.configure(config)
    fstab.configure(config)
    locale.configure(config)
    make.configure(config)
    net.configure(config)
    sysctl.configure(config)
    X.configure(config)
    bash.configure(config)
    sublime.configure(config)
    vim.configure(config)
    git.configure(config)
    mpv.configure(config)

    r = Path(config['path_to_root'], 'gentoo-install')
    if not r.exists():
        r.mkdir()
    shutil.copyfile('./config/system/.config', str(Path(r, '.config')))
    shutil.copytree('../package/package.keywords/', str(Path(config['path_to_root'], 'etc/portage/package.keywords/')))
    shutil.copytree('../package/package.unmask/', str(Path(config['path_to_root'], 'etc/portage/package.unmask/')))
    shutil.copytree('../package/package.use/', str(Path(config['path_to_root'], 'etc/portage/package.use/')))

    with general.create_file(Path(config['path_to_root'], 'var/lib/layman/make.conf')) as f:
        print('PORTDIR_OVERLAY="$PORTDIR_OVERLAY"', file=f)

    # generate shell install script
    with general.create_file(Path(config['path_to_root'], 'gentoo-chroot.sh')) as f:
        print('echo mounting ...', file=f)
        print('mount -t proc proc {}'.format(str(Path(config['path_to_root'], 'proc'))), file=f)
        print('mount --rbind /sys {}'.format(str(Path(config['path_to_root'], 'sys'))), file=f)
        print('mount --rbind /dev {}'.format(str(Path(config['path_to_root'], 'dev'))), file=f)
        print('echo chrooting ...', file=f)
        print('chroot {} /bin/bash'.format(config['path_to_root']), file=f)
        print('\n', file=f)

    with general.create_file(Path(config['path_to_root'], 'gentoo-install.sh')) as f:
        print('source /etc/profile', file=f)
        print('export PS1="(chroot) $PS1"', file=f)
        print('mkdir /usr/local/portage', file=f)
        print('\n', file=f)

        print('echo "SYNC ..."', file=f)
        print('emerge-webrsync', file=f)
        print('emerge --sync --quiet', file=f)
        print('\n', file=f)

        print('echo "Install gcc ..."', file=f)
        print('echo "emerge =sys-devel/gcc-4.8.2"', file=f)
        print('emerge =sys-devel/gcc-4.8.2', file=f)
        print('gcc-config -l', file=f)
        print('echo "Enter number of compiler:"', file=f)
        print('read cm', file=f)
        print('gcc-config ${cm}', file=f)
        print('echo "Rebuild qtcore(emerge dev-qt/qtcore)"', file=f)
        print('emerge dev-qt/qtcore', file=f)

        print('echo "Setting profile ..."', file=f)
        print('eselect profile list', file=f)
        print('echo "Enter number of profile:"', file=f)
        print('read pr', file=f)
        print('eselect profile set ${pr}', file=f)
        print('', file=f)

        print('echo "Install TimeZone ..."', file=f)
        print('echo "Europe/Moscow" > /etc/timezone', file=f)
        print('emerge --config sys-libs/timezone-data', file=f)
        print('', file=f)

        print('echo "Install locale ..."', file=f)
        print('locale-gen\n', file=f)
        print('eselect locale list', file=f)
        print('echo "Enter number of locale:"', file=f)
        print('read lc', file=f)
        print('eselect locale set ${lc}', file=f)
        print('env-update && source /etc/profile', file=f)

        print('echo "Install applications ..."', file=f)
        cmd = 'emerge -vuDN1 ' + ' '.join(applications_start)
        print('echo "{}"'.format(cmd), file=f)
        print(cmd, file=f)
        print('\n', file=f)

        print('echo "Update autorun ..."', file=f)
        print('rc-update add syslog-ng default', file=f)
        print('rc-update add cronie default', file=f)
        print('crontab /etc/crontab', file=f)
        print('rc-update add sshd default\n', file=f)
        print('rc-update add ntpd default\n', file=f)

        print('echo "Update /etc/mtab..."', file=f)
        print('grep -v rootfs /proc/mounts > /etc/mtab\n', file=f)

        print('echo "Network configure ... "\n', file=f)
        print('cd /etc/init.d', file=f)
        print('ln -s net.lo net.eth0', file=f)
        print('rc-update add net.eth0 default', file=f)
        print('\n', file=f)

        print('echo "Keyboard configure ... "\n', file=f)
        print('setxkbmap -layout "us,ru(winkeys)" -option grp:caps_toggle,grp_led:caps', file=f)

        print('echo "Kernel configure ... "\n', file=f)
        print('cp /gentoo-install/.config /usr/src/linux', file=f)
        print('genkernel --oldconfig --no-clean --no-mrproper', file=f)

        print('echo "Grug2 configure ... "\n', file=f)
        print('grub2-install ' + str(fstab.find_device_by_name(config['table'], '/')), file=f)
        print('grub2-mkconfig -o /boot/grub/grub.cfg', file=f)

        print('echo "Creating groups ..."', file=f)
        print('groupadd games', file=f)
        print('groupadd android', file=f)
        print('groupadd vboxusers', file=f)
        print('groupadd kvm', file=f)

        print('echo "Add user ..."', file=f)
        print('useradd -m -G wheel,audio,cdrom,video,usb,users,portage,games,android,vboxusers,kvm -s /bin/bash ' +
              config['user_name'] + '\n', file=f)
        print('echo "Enter new password for ' + config['user_name'] + '"', file=f)
        print('passwd ' + config['user_name'], file=f)
        print('echo "Enter new root password"', file=f)
        print('passwd', file=f)
        print('\n', file=f)

        print('echo "done!"', file=f)

    with general.create_file(Path(config['path_to_root'], 'gentoo-exit.sh')) as f:
        print("""
echo "exit && cd / && umount -l /mnt/gentoo/dev{/shm,/pts,} && umount -l /mnt/gentoo/proc"
""", file=f)

    with general.create_file(Path(config['path_to_root'], 'gentoo-install-my-tools.sh')) as f:
        cmd = 'emerge -f ' + ' '.join(applications_base) + ' '.join(applications_X) + ' '.join(applications_big) + ' '.join(applications_games) + ' '.join(applications_kde)
        print('echo "' + cmd + '"', file=f)
        print(cmd, file=f)
        cmd = 'emerge -1 ' + ' '.join(applications_base) + ' '.join(applications_X) + ' '.join(applications_big) + ' '.join(applications_games) + ' '.join(applications_kde)
        print('echo "' + cmd + '"', file=f)
        print(cmd, file=f)


    os.chmod(str(Path(config['path_to_root'], 'gentoo-install-my-tools.sh')), mode=755)
    os.chmod(str(Path(config['path_to_root'], 'gentoo-install.sh')), mode=755)
    os.chmod(str(Path(config['path_to_root'], 'gentoo-chroot.sh')), mode=755)
    os.chmod(str(Path(config['path_to_root'], 'gentoo-exit.sh')), mode=755)