Configuração pós-instalação do Slackware 14.2
Publicado por Ryuk Shinigami (última atualização em 17/02/2020)
[ Hits: 2.574 ]
Homepage: www.alem.com.br
Script que eu uso para configurar de modo prático e rápido o Slackware logo após a instalação. Publico aqui caso alguém queira adaptá-lo a sua necessidade.
#!/bin/bash # Configuração pós-instalação do Slackware 14.2 # Autor: PauloHAC (costapha@outlook.com) config_update() { # Atualiza certificados (wget): depende de "perl" update-ca-certificates -f # atualiza o sistema linha=$(grep -n "brasil" /etc/slackpkg/mirrors | grep -m1 "http" | cut -d: -f1) sed -i "$linha s/^# //" /etc/slackpkg/mirrors slackpkg update gpg slackpkg update slackpkg upgrade-all } config_sbopkg() { # Instala sbopkg ver=$(ls /var/log/packages/ | grep -c sbopkg) if [ "$ver" -gt 1 ]; then echo "sbopkg já instalado." else #wget https://github.com/sbopkg/sbopkg/releases/download/0.38.1/sbopkg-0.38.1-noarch-1_wsr.tgz #installpkg sbopkg-0.38.1-noarch-1_wsr.tgz sbover=$(lynx -dump https://sbopkg.org/downloads.php | grep -m1 -Eo 'https.*tgz$') wget $sbover installpkg sbopkg*.tgz sbopkg -r fi } config_timezone() { # Configurar relógio do sistema para UTC ou localtime timeconfig # Ajusta o relógio do hardware #hwclock --systohc } config_locale() { sed -i -e 's/^#//' -e 's/^/#/' /etc/profile.d/lang.sh echo 'export LINGUAS=pt_BR.UTF-8 export LANGUAGE=pt_BR.UTF-8 export LANG=pt_BR.UTF-8 export LC_COLLATE=C' | tee -a /etc/profile.d/lang.sh sed -i -e 's/^#//' -e 's/^/#/' /etc/profile.d/lang.csh grep ^export /etc/profile.d/lang.sh | sed -e "s/export/setenv/g" -e "s/\=/\ /g" >> /etc/profile.d/lang.csh # unicode echo '# unicode unicode_start' | tee -a /etc/rc.d/rc.local chmod +x /etc/rc.d/rc.local # MAN PAGES sed -i '/^NROFF/c \ NROFF /usr/bin/groff -Tlatin1 -mandoc' /etc/man.conf } config_keyboard() { echo 'Section "InputClass" Identifier "keyboard-all" MatchIsKeyboard "on" MatchDevicePath "/dev/input/event*" Driver "evdev" Option "XkbModel" "abnt2" Option "XkbLayout" "br" Option "XkbVariant" "abnt2" Option "XkbOptions" "terminate:ctrl_alt_bksp" EndSection' | tee /etc/X11/xorg.conf.d/90-keyboard-layout.conf } config_touchpad() { echo 'Section "InputClass" Identifier "touchpad" Driver "synaptics" MatchDevicePath "/dev/input/event*" MatchIsTouchpad "on" Option "TapButton1" "1" Option "TapButton2" "3" Option "TapButton3" "2" Option "VertTwoFingerScroll" "1" Option "VertEdgeScroll" "1" Option "TapAndDragGesture" "1" EndSection' | tee /etc/X11/xorg.conf.d/50-synaptics.conf } config_videotearingfix() { echo 'Section "Device" Identifier "Intel Graphics" Driver "Intel" Option "AccelMethod" "sna" Option "TearFree" "true" EndSection' | tee /etc/X11/xorg.conf.d/20-intel.conf } config_powerbuttonfix() { # Evita o desligamento ao apertar o botão "power" sed -i '/power/,+1s/^/#/' /etc/acpi/acpi_handler.sh } config_brigthness() { echo '# Ajusta brilho da tela de acordo com o horário Hora=$(date +%H) case $Hora in 0[6-9]|1[0-2]) echo 1801 >/sys/class/backlight/intel_backlight/brightness ;; 1[3-7]) echo 1201 >/sys/class/backlight/intel_backlight/brightness ;; 1[89]|2[0123]|0[0-5]) echo 601 >/sys/class/backlight/intel_backlight/brightness ;; esac' | tee -a /etc/rc.d/rc.local } config_firewall() { # sbopkg config_sbopkg # ufw sbopkg -i ufw echo '# UFW start if [ -x /lib/ufw/ufw-init ]; then /lib/ufw/ufw-init start fi' | tee -a /etc/rc.d/rc.local chmod +x /etc/rc.d/rc.local # Inetd sed -i '$i All: All' /etc/hosts.deny } config_ntpd() { # Configura servers sed -i '/list one/a \ server a.st1.ntp.br iburst \ server b.st1.ntp.br iburst \ server c.st1.ntp.br iburst \ server d.st1.ntp.br iburst' /etc/ntp.conf # Ativa o serviço no boot chmod +x /etc/rc.d/rc.ntpd # sincroniza ntpdate br.pool.ntp.org } config_user() { # Cria usuario adduser # Configura sudo read -p "Configurar SUDO para o usuario: " usuario grupo=$usuario groupadd -g 1000 $grupo groupadd -r sudo usermod -a -G ${grupo},sudo $usuario sed -i '/%sudo\|secure_path/s/# //' /etc/sudoers # xinit #su -l $usuario -c 'xwmconfig' # Desabilita "login-forturne" if [ -e /etc/profile.d/bsd-games-login-fortune.sh ]; then chmod -x /etc/profile.d/bsd-games-login-fortune.* fi } config_boot() { # Inittab sed -i '/initdefault/s/3/4/' /etc/inittab # Desabilitar tty[3-6] sed -i '/^c[3-6]/s/^/#/' /etc/inittab # Xinit xwmconfig # Cursor mkdir -p /usr/share/icons/default/ echo '[icon theme] Inherits=Adwaita' | tee /usr/share/icons/default/index.theme # XDM echo "Personalizando XDM..." sed -i '1 c Xcursor.theme: Adwaita' /etc/X11/xdm/Xresources sed -i 's/SteelBlue/Black/' /etc/X11/xdm/Xsetup_0 } config_kernelgeneric() { /usr/share/mkinitrd/mkinitrd_command_generator.sh | bash ln -sfv /boot/System.map-generic-$(uname -r) /boot/System.map ln -sfv /boot/config-generic-$(uname -r)* /boot/config ln -sfv /boot/vmlinuz-generic-$(uname -r) /boot/vmlinuz rm -fv /boot/vmlinuz-huge /boot/vmlinuz-generic mv -v /boot/vmlinuz-huge-$(uname -r) /boot/disabled-vmlinuz-huge-$(uname -r) #grub-mkconfig -o /boot/grub/grub.cfg #lilo } # Backups if [ ! -d /root/backups ]; then mkdir /root/backups echo "Backup dos arquivos de configuração..." cp -v /etc/acpi/acpi_handler.sh /root/backups cp -v /etc/hosts.deny /root/backups cp -v /etc/inittab /root/backups cp -v /etc/ntp.conf /root/backups cp -v /etc/man.conf /root/backups cp -v /etc/profile.d/lang* /root/backups cp -v /etc/rc.d/rc.local /root/backups cp -v /etc/slackpkg/mirrors /root/backups cp -v /etc/sudoers /root/backups fi if [ ! -d /etc/X11/xorg.conf.d ]; then mkdir /etc/X11/xorg.conf.d fi # MENU for f in \ config_update \ config_sbopkg \ config_timezone \ config_locale \ config_keyboard \ config_touchpad \ config_videotearingfix \ config_powerbuttonfix \ config_brigthness \ config_firewall \ config_ntpd \ config_user \ config_boot \ config_kernelgeneric do while read -p "Deseja executar a função: $f? (S,n): " resp do case ${resp:=S} in S|s) $f ; break ;; N|n) break ;; *) echo "Resposta inválida!" ;; esac done done echo "Fim do script"
administrador do farmacia administra una farmacia
Configuração Apache e DNS (bind)
Copiando um arquivo matriz para vários outros com nomes diferentes...
Conciliando o uso da ZRAM e SWAP em disco na sua máquina
Servidor de Backup com Ubuntu Server 24.04 LTS, RAID e Duplicati (Dell PowerEdge T420)
Visualizar câmeras IP ONVIF no Linux sem necessidade de instalar aplicativos
Realizar overclock no Miyoo Mini (plus ou normal)
Otimização de memória para máquinas modestas
Dúvidas sobre a originalidade de conteúdos online (9)
Monitoramento pfsense com zabbix (3)
Google Crhome não abre desde que eu atualizei pelo "program... (13)
como instalar o amdgpu no linux manjaro no linux, pelo o repo e comand... (4)