diff --git a/README.md b/README.md index 19de054e3c417f1443fd229039b3a4d391c51454..d88c102e632e7db0bacd55f2666234bb20706d00 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Configuração do Ubuntu 16.04 LTS para computadores multiterminais do ProInfo -**Aqui você encontra apenas algumas informações resumidas sobre este roteiro. A documentação completa está disponÃvel em nosso [wiki](../../wikis/home).** +**URGENTE: seu multiterminal parou de funcionar após uma atualização de sistema? Leia [isto](../../wikis/problemas-com-atualizacoes-de-sistema)!** + +*Aqui você encontra apenas algumas informações resumidas sobre este roteiro. A documentação completa está disponÃvel em nosso [wiki](../../wikis/home).* ## Pregões contemplados por esta solução @@ -15,7 +17,7 @@ ### Observações -* É possÃvel que esta solução se aplique também aos computadores do pregão 23/2012, mas nós não tivemos ainda a oportunidade de testá-la, pois não temos equipamentos deste pregão em nenhuma escola municipal de Mogi das Cruzes. +* Esta solução não se aplica aos computadores do pregão 23/2012, devido à falta de um driver de vÃdeo compatÃvel com as placas TN-750. * Esta solução pode aplicar-se a outros pregões do ProInfo Rural, **desde que a placa de vÃdeo original ATI Rage XL Quad seja substituÃda por um par de placas TN-502 Dual ou uma placa TN-502 Quad**. ## Sabores do Ubuntu recomendados para os computadores do ProInfo @@ -24,9 +26,9 @@ Os sabores e arquiteturas do Ubuntu que nós recomendamos para os computadores d | Tipo de computador | Sabor do Ubuntu | Arquitetura | |:---------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------:| -| multiterminal com menos de 2GB de memória RAM | [Xubuntu](http://cdimage.ubuntu.com/xubuntu/releases/xenial/release/xubuntu-16.04-desktop-i386.iso) ou [Lubuntu](http://cdimage.ubuntu.com/lubuntu/releases/16.04/release/lubuntu-16.04-desktop-i386.iso) | 32 bits | -| multiterminal com 2GB de memória RAM ou mais | [Xubuntu](http://cdimage.ubuntu.com/xubuntu/releases/xenial/release/xubuntu-16.04-desktop-amd64.iso) ou [Lubuntu](http://cdimage.ubuntu.com/lubuntu/releases/16.04/release/lubuntu-16.04-desktop-amd64.iso) | 64 bits | -| servidor | [Ubuntu MATE](http://cdimage.ubuntu.com/ubuntu-mate/releases/xenial/release/ubuntu-mate-16.04-desktop-amd64.iso) | 64 bits | +| multiterminal com menos de 2GB de memória RAM (4GB para até 5 terminais) | [Xubuntu](http://cdimage.ubuntu.com/xubuntu/releases/xenial/release/xubuntu-16.04-desktop-i386.iso) ou [Lubuntu](http://cdimage.ubuntu.com/lubuntu/releases/16.04/release/lubuntu-16.04-desktop-i386.iso) | 32 bits | +| multiterminal com 2GB de memória RAM (para até 3 terminais) ou mais | [Xubuntu](http://cdimage.ubuntu.com/xubuntu/releases/xenial/release/xubuntu-16.04-desktop-amd64.iso) ou [Lubuntu](http://cdimage.ubuntu.com/lubuntu/releases/16.04/release/lubuntu-16.04-desktop-amd64.iso) | 64 bits | +| servidor | [Xubuntu](http://cdimage.ubuntu.com/xubuntu/releases/xenial/release/xubuntu-16.04-desktop-amd64.iso) ou [Ubuntu MATE](http://cdimage.ubuntu.com/ubuntu-mate/releases/xenial/release/ubuntu-mate-16.04-desktop-amd64.iso) | 64 bits | ## Resumo do roteiro @@ -42,7 +44,7 @@ Os sabores e arquiteturas do Ubuntu que nós recomendamos para os computadores d Caso algum de seus computadores seja afetado pelo [bug da tela listrada](../../wikis/O-bug-da-tela-listrada), os seguintes passos adicionais são necessários para utilizá-lo em sua capacidade máxima (3 terminais no ProInfo Urbano e 4~5 terminais no ProInfo Rural): -1. Instale o Linux Educacional 5.0 a partir da ISO disponÃvel na [página de suporte do Paraná Digital](http://www.prdsuporte.seed.pr.gov.br/uploads/Linux-Educacional_5.0.2-1-escola-le5-stable-i386-20150817.iso), seguindo [este roteiro](wikis/Instalacao-do-Linux-Educacional-5-0). -2. Configure o multiterminal no LE 5.0 seguindo [este roteiro](wikis/Configuracao-do-multiterminal-no-Linux-Educacional-5-0). **Não é necessário completar a associação de teclados/mouses, tampouco ativar a licença do Userful Multiseat**. -3. Reinicie o computador de volta para o Ubuntu 16.04 LTS e execute o script `contornar-bug-tela-listrada.sh` que consta desta solução. -4. Desligue e ligue novamente o computador. +1. Baixe a ISO para recuperação do vÃdeo, disponÃvel no nosso [Google Drive](https://drive.google.com/open?id=0B_0RrXAKZ1hbdnRvcGRuSFc2Nkk). +2. Mova a ISO baixada para a pasta `/boot/userful-rescue`. +3. Execute o script `contornar-bug-tela-listrada.sh` que consta desta solução. +4. Desligue e ligue novamente o computador. \ No newline at end of file diff --git a/configurar-multiterminal-xephyr.sh b/configurar-multiterminal-xephyr.sh index 85f97d8627492795ca834b33cf0df8507ffdceb9..6a2190d6b66913264e4112dc6cb938b1d6908147 100755 --- a/configurar-multiterminal-xephyr.sh +++ b/configurar-multiterminal-xephyr.sh @@ -1,26 +1,48 @@ #!/bin/bash +# Copia arquivos do X para systemd install -m 644 systemd/xorg-daemon.s* /etc/systemd/system +# Copia configs de usb para o udev install -m 644 udev/* /etc/udev/rules.d +# Cria diretorio install -d /etc/X11/xorg.conf.d +# Copia configurações de monitores para xorg install -m 644 xorg/9[78]*.conf /etc/X11/xorg.conf.d + +# Copia scripts para bin +# mapeia as portas usb para monitores install -m 755 seat-attach-assistant /usr/local/bin +# Copia script que atualiza entradas no xorg para bin (explicado no arquivo) install -m 755 update-xorg-conf /usr/local/bin +# Copia script para executar o X para bin install -m 755 xorg-daemon /usr/local/bin +# Copia script do Xephyr para bin install -m 755 xephyr-wrapper /usr/local/bin +# Cria diretorio e copia configs do lightdm install -d /etc/xdg/lightdm/lightdm.conf.d install -m 644 lightdm/*.conf /etc/xdg/lightdm/lightdm.conf.d -update-xorg-conf SM501 /etc/X11/xorg.conf.d/98-proinfo-*.conf +# roda o script que atualiza as configs do xorg +update-xorg-conf "Silicon.Motion" /etc/X11/xorg.conf.d/98-proinfo-*.conf +# habilita e roda o xorg-daemon systemctl enable xorg-daemon.socket systemctl start xorg-daemon.socket +# adiciona ppa (repositorio pessoal) do xephyr e instala x, numlock, xserver, xephyr, etc apt-add-repository ppa:ubuntu-multiseat/xephyr apt update apt -y upgrade -apt -y install xserver-xorg-video-siliconmotion xserver-xephyr compton numlockx +apt -y --allow-downgrades install xserver-xorg-video-siliconmotion compton numlockx xserver-{common,xorg-core,xephyr}=2:1.18.3-1ubuntu2.3+multiseat0 + +# Coloca pacotes do xorg e xephyr em hold (nao muda a versao em atualizações) +for i in common xorg-core xephyr +do + echo "xserver-$i hold" | dpkg --set-selections + [ -x /usr/bin/aptitude ] && aptitude hold xserver-$i +done +# Pede eventos ao kernel: "força" a identificação dos dispositivos na maquina udevadm trigger systemctl restart lightdm diff --git a/configurar-multiterminal-xf86-video-nested.sh b/configurar-multiterminal-xf86-video-nested.sh index c9e8a9a1245662e6673a28bbd13a93f54280027b..a7931fd87f87ffda5b06d40453e37879eae4a646 100755 --- a/configurar-multiterminal-xf86-video-nested.sh +++ b/configurar-multiterminal-xf86-video-nested.sh @@ -12,7 +12,7 @@ install -m 755 xorg-daemon /usr/local/bin install -d /etc/xdg/lightdm/lightdm.conf.d install -m 644 lightdm/9[5679]*.conf /etc/xdg/lightdm/lightdm.conf.d -update-xorg-conf SM501 /etc/X11/xorg.conf.d/98-proinfo-*.conf +update-xorg-conf "Silicon.Motion" /etc/X11/xorg.conf.d/98-proinfo-*.conf systemctl enable xorg-daemon.socket systemctl start xorg-daemon.socket diff --git a/configurar-multiterminal.sh b/configurar-multiterminal.sh deleted file mode 100755 index a80a2dce1f01f94c00b59ef0ebdb06c893be7a56..0000000000000000000000000000000000000000 --- a/configurar-multiterminal.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -install -m 644 systemd/xorg-daemon.s* /etc/systemd/system -install -m 644 udev/* /etc/udev/rules.d - -install -d /etc/X11/xorg.conf.d -install -m 644 xorg/*.conf /etc/X11/xorg.conf.d -install -m 755 seat-attach-assistant /usr/local/bin -install -m 755 update-xorg-conf /usr/local/bin -install -m 755 xorg-daemon /usr/local/bin - -install -d /etc/xdg/lightdm/lightdm.conf.d -install -m 644 lightdm/*.conf /etc/xdg/lightdm/lightdm.conf.d - -update-xorg-conf SM501 /etc/X11/xorg.conf.d/99-proinfo-*.conf -systemctl enable xorg-daemon.socket -systemctl start xorg-daemon.socket - -apt-add-repository ppa:ubuntu-multiseat/ppa -apt update -apt -y upgrade -apt -y install xserver-xorg-video-siliconmotion xserver-xephyr compton numlockx - -udevadm trigger -systemctl restart lightdm diff --git a/configurar-multiterminal.sh b/configurar-multiterminal.sh new file mode 120000 index 0000000000000000000000000000000000000000..186554f27ddb62681631354b909edae7b35360c7 --- /dev/null +++ b/configurar-multiterminal.sh @@ -0,0 +1 @@ +configurar-multiterminal-xephyr.sh \ No newline at end of file diff --git a/contornar-bug-tela-listrada.sh b/contornar-bug-tela-listrada.sh index 9d2ffc467afb705c6ec683e5104a5c167e71dcbe..125db6ab6d13a57c0a72d8e543f8e5bc48b55fbf 100755 --- a/contornar-bug-tela-listrada.sh +++ b/contornar-bug-tela-listrada.sh @@ -1,66 +1,37 @@ #!/bin/bash -indice=0 -particao= -le5_encontrado=false +if ! [ -d /boot/userful-rescue -a -f /boot/userful-rescue/userful-rescue-live-20160628-i386.iso ] +then + cat << EOF -encontrar_le5() { - while read -r linha - do - if echo "${linha}" | grep "menuentry.*Linux Educacional 5.0" >/dev/null - then - particao=$(echo ${linha} | cut -d' ' -f7 | cut -d')' -f1) - le5_encontrado=true - break - else - indice=$(( indice + 1 )) - fi - done < <(grep "^menuentry\|submenu" /boot/grub/grub.cfg) -} +[ERRO] Userful Rescue Live não encontrado! + Baixe a ISO do Userful Rescue Live no endereço -encontrar_le5 + https://drive.google.com/open?id=0B_0RrXAKZ1hbdnRvcGRuSFc2Nkk -if ! ${le5_encontrado} -then - # Partição do LE 5.0 não detectada. - # Atualizando o menu do GRUB e tentando novamente... - indice=0 - update-grub - encontrar_le5 -fi + e salve-a na pasta /boot/userful-rescue. + Depois disso, execute este script novamente. -if ! ${le5_encontrado} -then - echo - echo "[ERRO] Partição do Linux Educacional 5.0 não detectada!" - echo " Certifique-se de que o Linux Educacional 5.0" - echo " está instalado em uma outra partição." +EOF exit 1 fi -echo -echo "[INFO] Partição do Linux Educacional 5.0 encontrada em ${particao}." -echo " Ãndice correspondente no menu do GRUB: ${indice}." +install -m 755 userful-rescue-{enable,disable} /usr/local/bin +install -m 755 grub/42_userful-rescue /etc/grub.d +update-grub -install -m 644 systemd/le-nextboot-* /etc/systemd/system +install -m 644 systemd/userful-rescue-nextboot-* /etc/systemd/system +systemctl enable userful-rescue-nextboot-reboot.service +systemctl enable userful-rescue-nextboot-read-write.service +systemctl start userful-rescue-nextboot-read-write.service -cat > /etc/le-nextboot.conf << EOF -LE_NEXTBOOT_ENABLE=true -LE_NEXTBOOT_INDEX=${indice} -EOF +cat << EOF -systemctl enable le-nextboot-poweroff.service -grub-reboot ${indice} +[AVISO] Agora você deve desligar o computador e ligá-lo novamente. + O computador deve iniciar no Userful Rescue Live e reiniciar + automaticamente de volta para este sistema. -mount ${particao} /mnt -install -m 644 userful/auto_login.conf /mnt/etc/userful -install -m 755 userful/auto-reboot /mnt/usr/local/bin -umount /mnt + Uma vez concluÃdo o processo, você pode reiniciar o computador + sempre que necessário. -echo -echo "[AVISO] Agora você deve desligar o computador e ligá-lo novamente." -echo " O computador deve iniciar no Linux Educacional 5.0 e reiniciar" -echo " automaticamente de volta para este sistema." -echo -echo " Uma vez concluÃdo o processo, você pode reiniciar o computador" -echo " sempre que necessário." +EOF diff --git a/criar-usuarios-alunos-lubuntu.sh b/criar-usuarios-alunos-lubuntu.sh index 584269b0765faeae6b3ce6d38bbe413acfbbf55b..0595cd00b5e2a4e8bec6c634e44fa0e18e614516 100755 --- a/criar-usuarios-alunos-lubuntu.sh +++ b/criar-usuarios-alunos-lubuntu.sh @@ -1,17 +1,21 @@ #!/bin/bash +freeze_template_user="freezetemplate" +freeze_template_fullname="Modelo para Freeze" + addgroup freeze -adduser --gecos "Modelo para Freeze" --shell /bin/bash freezetemplate +adduser --disabled-login --gecos "${freeze_template_fullname}" --shell /bin/bash ${freeze_template_user} +echo "${freeze_template_user}:freeze" | chpasswd for i in 0 1 2 3 4 do adduser --disabled-login --gecos "Aluno #${i}" --shell /bin/bash aluno${i} adduser aluno${i} freeze - echo aluno${i}:aluno${i} | chpasswd + echo "aluno${i}:aluno${i}" | chpasswd done apt update -apt -y install libpam-mount bindfs +apt -y install libpam-mount bindfs python-gnomekeyring install -d /etc/xdg/lightdm/lightdm.conf.d install -m 644 lightdm/96-disable-guest.conf /etc/xdg/lightdm/lightdm.conf.d @@ -25,11 +29,10 @@ install -m 644 lubuntu/*.desktop /usr/local/share/file-manager/actions install -m 755 lubuntu/*-pkexec /usr/local/bin install -m 755 freeze-session-auto /usr/local/bin -install -d /home/freezetemplate/.config/autostart -install -m 644 autostart/freeze-session-auto.desktop /home/freezetemplate/.config/autostart -install -m 644 autostart-disable/*.desktop /home/freezetemplate/.config/autostart - -mkdir -m 0777 /var/freeze-data -ln -s /var/freeze-data "/home/freezetemplate/SALVAR AQUI!" +install -d /home/${freeze_template_user}/.config/autostart +install -m 644 autostart/freeze-session-auto.desktop /home/${freeze_template_user}/.config/autostart +install -m 644 autostart-disable/*.desktop /home/${freeze_template_user}/.config/autostart chown -R freezetemplate:freezetemplate /home/freezetemplate + +mkdir -pm 0777 /var/freeze-data/{documents,pictures,music,videos} diff --git a/criar-usuarios-alunos-xubuntu.sh b/criar-usuarios-alunos-xubuntu.sh index fbe27bf33690a01a5b9316ee281da5433c0ea8d4..db4ac0c55a9e839bd2fb7d4789fd886628235d6e 100755 --- a/criar-usuarios-alunos-xubuntu.sh +++ b/criar-usuarios-alunos-xubuntu.sh @@ -1,34 +1,55 @@ #!/bin/bash +freeze_template_user="freezetemplate" +freeze_template_fullname="Modelo para Freeze" + +# Cria grupo "freeze" addgroup freeze -adduser --gecos "Modelo para Freeze" --shell /bin/bash freezetemplate +# Cria usuário "freezetemplate" no grupo "freeze", com login desabilitado +adduser --disabled-login --gecos "${freeze_template_fullname}" --shell /bin/bash ${freeze_template_user} +# senha "freeze" +echo "${freeze_template_user}:freeze" | chpasswd +# Cria aluno$i com senha aluno$i, com login desabilitado, no grupo "freeze" for i in 0 1 2 3 4 do adduser --disabled-login --gecos "Aluno #${i}" --shell /bin/bash aluno${i} adduser aluno${i} freeze - echo aluno${i}:aluno${i} | chpasswd + echo "aluno${i}:aluno${i}" | chpasswd done +# Atualiza lista de pacotes e instala PAM (autenticação), bindfs (espelhar um diretorio, mas com permissoes diferentes) e python-gnomekeyring (gnome keyring: gerenciamento de chaves e senhas) apt update -apt -y install libpam-mount bindfs +apt -y install libpam-mount bindfs python-gnomekeyring +# Cria diretorio install -d /etc/xdg/lightdm/lightdm.conf.d +# Copia arquivo que desabilita o usuario convidado para o diretório, com permissões rw-r--r-- (uuugggooo) install -m 644 lightdm/96-disable-guest.conf /etc/xdg/lightdm/lightdm.conf.d +# Copia script (Cria pastas para o OverlayFS) para sbin, com permissoes rwxr-xr-x install -m 755 mount-wrapper /usr/local/sbin +# Copia script (limpa o sistema) para sbin install -m 755 prepare-clonezilla /usr/local/sbin +# Copia arquivo (com configurações para montagem dos diretórios usando PAM e Overlay) para security install -m 644 pam_mount.conf.xml /etc/security +# Copia arquivo com descrição e traduções para terminal install -m 644 xubuntu/*.policy /usr/share/polkit-1/actions +# Copia script para bin (Explicado no proprio arquivo) install -m 755 freeze-session-auto /usr/local/bin -install -d /home/freezetemplate/.config/autostart -install -m 644 autostart/freeze-session-auto.desktop /home/freezetemplate/.config/autostart -install -m 644 autostart-disable/*.desktop /home/freezetemplate/.config/autostart - -install -d /home/freezetemplate/.config/Thunar -install -m 644 xubuntu/uca.xml /home/freezetemplate/.config/Thunar - -mkdir -m 0777 /var/freeze-data -ln -s /var/freeze-data "/home/freezetemplate/SALVAR AQUI!" - -chown -R freezetemplate:freezetemplate /home/freezetemplate +# Cria diretorio +install -d /home/${freeze_template_user}/.config/autostart +# Copia config que executa o script freeze-session-auto para o autostart do freeze +install -m 644 autostart/freeze-session-auto.desktop /home/${freeze_template_user}/.config/autostart +# Copia config que "esconde" alguns programas +install -m 644 autostart-disable/*.desktop /home/${freeze_template_user}/.config/autostart + +# Cria diretorio +install -d /home/${freeze_template_user}/.config/Thunar +# Copia config do xubuntu versao Thunar para o diretorio +install -m 644 xubuntu/uca.xml /home/${freeze_template_user}/.config/Thunar +# Altera o dono de toda a arvore sob /home/freezetemplate (VERIFICAR se o grupo esta correto (existe)) +chown -R "${freeze_template_user}:${freeze_template_user}" /home/${freeze_template_user} + +# Cria diretórios de usuario em /var/freeze-data/ +mkdir -pm 0777 /var/freeze-data/{documents,pictures,music,videos} diff --git a/criar-usuarios-alunos.sh b/criar-usuarios-alunos.sh deleted file mode 100755 index f9db37617cb407ce9ed9c832e6eef8aae9902da2..0000000000000000000000000000000000000000 --- a/criar-usuarios-alunos.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -addgroup freeze -adduser --gecos "Modelo para Freeze" --shell /bin/bash freezetemplate - -for i in 0 1 2 3 4 -do - adduser --disabled-login --gecos "Aluno #${i}" --shell /bin/bash aluno${i} - adduser aluno${i} freeze - echo aluno${i}:aluno${i} | chpasswd -done - -apt update -apt -y install libpam-mount bindfs - -install -d /etc/xdg/lightdm/lightdm.conf.d -install -m 644 lightdm/96-disable-guest.conf /etc/xdg/lightdm/lightdm.conf.d -install -m 755 mount-wrapper /usr/local/sbin -install -m 644 pam_mount.conf.xml /etc/security - -install -m 755 freeze-session-auto /usr/local/bin -install -d /home/freezetemplate/.config/autostart -install -m 644 autostart/freeze-session-auto.desktop /home/freezetemplate/.config/autostart -chown -R freezetemplate:freezetemplate /home/freezetemplate diff --git a/criar-usuarios-alunos.sh b/criar-usuarios-alunos.sh new file mode 120000 index 0000000000000000000000000000000000000000..bdf0d8cb21ea14daf03f0927fc195fae6112bf47 --- /dev/null +++ b/criar-usuarios-alunos.sh @@ -0,0 +1 @@ +criar-usuarios-alunos-xubuntu.sh \ No newline at end of file diff --git a/freeze-session-auto b/freeze-session-auto index 1bbcc95d8bb4b3948bd10f7a9880834db7dbda1c..902eb5612e8b961a923a96a94ebf5704fdcebcad 100755 --- a/freeze-session-auto +++ b/freeze-session-auto @@ -21,26 +21,36 @@ # Não executar este script para o próprio usuário freezetemplate [ "${USER}" = "freezetemplate" ] && exit 0 +# Remove arquivos do diretorio ~/.cache [ "$(ls -A ${HOME}/.cache)" ] && rm -rf ${HOME}/.cache/* + +# Remove arquivos "temporario" das coisas do mozilla find ${HOME}/.mozilla -type f -name secmod.db -delete +# Remove arquivos de erro do X e log da sessão do xfce for i in ${HOME}/.xfce4-session.verbose-log* \ ${HOME}/.xsession-errors* do [ -f ${i} ] && rm ${i} done +# Substitui as referencias à "/home/freezetemplate" por ${HOME} do usuário em questão, nos arquivos de configuração abaixo for i in ${HOME}/.pki/nssdb/pkcs11.txt \ ${HOME}/.config/gtk-3.0/bookmarks \ ${HOME}/.config/vlc/vlc-qt-interface.conf \ ${HOME}/.config/chromium/Default/Preferences \ ${HOME}/.config/xfce4/desktop/icons.screen*.rc do + # -f: se existe -i: muda o proprio arquivo s: substitui /home/freezetemplate por ${HOME} em g: todas as ocorrências no arquivo ${i} [ -f ${i} ] && sed -i -e "s@/home/freezetemplate@${HOME}@g" ${i} done +# Substitui refererncias ao usuario freezetemplate por ${USER} nos arquivos do wine for i in ${HOME}/.wine/userdef.reg \ ${HOME}/.wine/user.reg do [ -f ${i} ] && sed -i -e "s@freezetemplate@${USER}@g" ${i} done + +# Destrava a senha do usuario +python -c "import gnomekeyring; gnomekeyring.unlock_sync(None, 'freeze')" diff --git a/grub/42_userful-rescue b/grub/42_userful-rescue new file mode 100755 index 0000000000000000000000000000000000000000..8f32f6ddbcfdb51fa8cde97344148d7292fed418 --- /dev/null +++ b/grub/42_userful-rescue @@ -0,0 +1,45 @@ +#!/bin/sh +set -e + +prefix="/usr" +exec_prefix="${prefix}" +bindir="${exec_prefix}/bin" +libdir="${exec_prefix}/lib" + +ISO_LOCATION="/boot/userful-rescue" + +if [ -r ${libdir}/grub/grub-mkconfig_lib ] ; then + . ${libdir}/grub/grub-mkconfig_lib +elif [ -r /usr/share/grub/grub-mkconfig_lib ] ; then # fallback for e.g. Fedora + . /usr/share/grub/grub-mkconfig_lib +elif [ -r /usr/share/grub2/grub-mkconfig_lib ] ; then # same for openSUSE + . /usr/share/grub2/grub-mkconfig_lib +else + echo "Could not locate file grub-mkconfig_lib, please report a bug." >&2 +fi + +iso_list="" +for file in "${ISO_LOCATION}"/*.iso ; do + if grub_file_is_not_garbage "${file}" ; then + iso_list="${file} ${iso_list} " + fi +done + +for userful_iso in ${iso_list} ; do + rel_dirname="$(dirname $(make_system_path_relative_to_its_root ${userful_iso}))" + iso_file="$(basename ${userful_iso})" + device="$(${grub_probe} -t device ${userful_iso})" + grub_prep=$(prepare_grub_to_access_device "${device}" | sed -e "s/^/ /") + onstr="$(gettext_printf "(%s)" "${iso_file}")" + gettext_printf "Found Userful Rescue Live: %s\n" "${iso_file}" >&2 + + cat << EOF +menuentry '$(echo "Userful Rescue Live" | grub_quote)' { +${grub_prep} + set isofile="${rel_dirname%/}/${iso_file}" + loopback loop \$isofile + linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=\$isofile + initrd (loop)/casper/initrd.img +} +EOF +done diff --git a/mount-wrapper b/mount-wrapper index d037108367856d2babd57dde4a93d2de30fa57c1..844e72c8dae108dc846c03e500131253d6599544 100755 --- a/mount-wrapper +++ b/mount-wrapper @@ -23,14 +23,51 @@ # On Debian GNU/Linux systems, the complete text of the GNU General # Public License can be found in `/usr/share/common-licenses/GPL'. ########################################################################### -for arg in "${@}" +options=() +user=${1} +HOME=/home/${user} +shift + +source ${HOME}/.config/user-dirs.dirs + +while [ ${1} ] do - case "${arg}" in + case "${1}" in -toverlay) - mkdir ${!#}/{upper,work} - chown $(stat -c '%U:%G' ${!#}) ${!#}/{upper,work} - ;; - esac + mkdir ${!#}/{upper,work} + chown $(stat -c '%U:%G' ${!#}) ${!#}/{upper,work} + options+=("${1}") + ;; + @DESKTOP@) + options+=("${XDG_DESKTOP_DIR}") + ;; + @DOCUMENTS@) + options+=("${XDG_DOCUMENTS_DIR}") + ;; + @DOWNLOAD@) + options+=("${XDG_DOWNLOAD_DIR}") + ;; + @PICTURES@) + options+=("${XDG_PICTURES_DIR}") + ;; + @PUBLICSHARE@) + options+=("${XDG_PUBLICSHARE_DIR}") + ;; + @MUSIC@) + options+=("${XDG_MUSIC_DIR}") + ;; + @TEMPLATES@) + options+=("${XDG_TEMPLATES_DIR}") + ;; + @VIDEOS@) + options+=("${XDG_VIDEOS_DIR}") + ;; + *) + options+=("${1}") + ;; + esac + + shift done -exec mount "${@}" +exec mount "${options[@]}" diff --git a/pam_mount.conf.xml b/pam_mount.conf.xml index 7bc8869d530564de3df2b52182b3c9c690ae696f..a008cbe3c0f6077c3f850c72e7c03b7f44a43b5d 100644 --- a/pam_mount.conf.xml +++ b/pam_mount.conf.xml @@ -15,9 +15,13 @@ <!-- Volume definitions --> <msg-authpw>Password: </msg-authpw> -<lclmount>/usr/local/sbin/mount-wrapper -t%(FSTYPE) "%(if %(OPTIONS),-o%(OPTIONS))" %(VOLUME) %(MNTPT)</lclmount> +<lclmount>/usr/local/sbin/mount-wrapper %(USER) -t%(FSTYPE) "%(if %(OPTIONS),-o%(OPTIONS))" %(VOLUME) %(MNTPT)</lclmount> <volume sgrp="freeze" fstype="tmpfs" options="mode=0700,uid=%(USERUID),gid=%(USERGID)" mountpoint="~" /> <volume sgrp="freeze" fstype="overlay" options="lowerdir=/home/freezetemplate,upperdir=/home/%(USER)/upper,workdir=/home/%(USER)/work" path="overlay" mountpoint="~" /> +<volume sgrp="freeze" options="bind" path="/var/freeze-data/documents" mountpoint="@DOCUMENTS@" /> +<volume sgrp="freeze" options="bind" path="/var/freeze-data/pictures" mountpoint="@PICTURES@" /> +<volume sgrp="freeze" options="bind" path="/var/freeze-data/music" mountpoint="@MUSIC@" /> +<volume sgrp="freeze" options="bind" path="/var/freeze-data/videos" mountpoint="@VIDEOS@" /> <volume sgrp="freeze" fstype="fuse.bindfs" options="force-user=%(USER),force-group=%(GROUP)" path="~" mountpoint="~" /> <!-- pam_mount parameters: General tunables --> diff --git a/reconfigurar-rede.sh b/reconfigurar-rede.sh index e5fc009a789169a5f8c45f93b1a492d30e283d50..6b2a7e8761e417061eacc7074b83e6ea5ff94493 100755 --- a/reconfigurar-rede.sh +++ b/reconfigurar-rede.sh @@ -1,25 +1,38 @@ #!/bin/bash +# Copia arquivo de rede cabeada para systemd install -m 644 systemd/cabeada.network /etc/systemd/network +# Copia arquivo de hostname dinamico para polkit install -m 644 systemd/*.pkla /etc/polkit-1/localauthority/50-local.d - +# Copia arquivo que esconde o nm no autostart (nm pode ser network-manager) install -m 644 autostart-disable-nm/*.desktop /home/freezetemplate/.config/autostart + +# Altera dono de toda a arvore sob ~freezetemplate/.config/autostart (VERIFICAR se existe o grupo) chown -R freezetemplate:freezetemplate /home/freezetemplate/.config/autostart + +# Configurações para wifi if [ -n "${wifi_iface}" ] then + # configruação de rede wifi install -m 644 systemd/wifi.network /etc/systemd/network + # serviço do sistema (via systemd) install -m 644 systemd/wpa_supplicant@.service /etc/systemd/system + # cria diretorio install -d /etc/wpa_supplicant + # Copia config do wpa_supplicant install -m 644 systemd/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf fi +# desabilita network-manager systemctl stop NetworkManager systemctl disable NetworkManager +# desabilita serviço de "compatibilidade" systemctl stop networking systemctl disable networking +# habilita e inicia rede via systemd systemctl enable systemd-networkd systemctl enable systemd-networkd-wait-online systemctl enable systemd-resolved @@ -28,4 +41,5 @@ systemctl start systemd-networkd systemctl start systemd-networkd-wait-online systemctl start systemd-resolved +# faz link para arquivo de dns ln -sf /var/run/systemd/resolve/resolv.conf /etc/resolv.conf diff --git a/seat-attach-assistant b/seat-attach-assistant index 940a4ea1a5db6e3ca224126dad0150b7be6cb11b..9bcbc7721cfad469b3c59cdda98004156979efb3 100755 --- a/seat-attach-assistant +++ b/seat-attach-assistant @@ -3,8 +3,8 @@ case "${1}" in *1) seat_id=seat-V0 ;; *2) seat_id=seat-L0 ;; - *3) [ $(lspci | grep -c SM501) -gt 1 ] && seat_id=seat-V1 ;; - *4) [ $(lspci | grep -c SM501) -gt 1 ] && seat_id=seat-L1 ;; + *3) [ $(lspci | grep -c "Silicon.Motion") -gt 1 ] && seat_id=seat-V1 ;; + *4) [ $(lspci | grep -c "Silicon.Motion") -gt 1 ] && seat_id=seat-L1 ;; esac [ -n "${seat_id}" ] && loginctl attach ${seat_id} /sys/${1} diff --git a/systemd/le-nextboot-poweroff.service b/systemd/le-nextboot-poweroff.service deleted file mode 100644 index abaa57dfc346b44ab036433149908545a46c96b8..0000000000000000000000000000000000000000 --- a/systemd/le-nextboot-poweroff.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Schedule next boot to Linux Educacional on system power off -After=getty@tty1.service display-manager.service -Before=systemd-halt.service systemd-poweroff.service -DefaultDependencies=no - -[Service] -Type=oneshot -EnvironmentFile=/etc/le-nextboot.conf -ExecStart=/bin/sh -c "${LE_NEXTBOOT_ENABLE} && grub-reboot ${LE_NEXTBOOT_INDEX}" - -[Install] -WantedBy=halt.target poweroff.target diff --git a/systemd/le-nextboot-poweroff@.service b/systemd/le-nextboot-poweroff@.service deleted file mode 100644 index 7d38855e5b27ca79a53be3a29b5483f2358e3104..0000000000000000000000000000000000000000 --- a/systemd/le-nextboot-poweroff@.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Schedule next boot to Linux Educacional on system power off -After=getty@tty1.service display-manager.service -Before=systemd-halt.service systemd-poweroff.service -DefaultDependencies=no - -[Service] -Type=oneshot -ExecStart=/usr/sbin/grub-reboot %i - -[Install] -WantedBy=halt.target poweroff.target diff --git a/systemd/le-nextboot-read-write.service b/systemd/le-nextboot-read-write.service deleted file mode 100644 index a4c64ae0f82bf81cb206326e73751488df23ab33..0000000000000000000000000000000000000000 --- a/systemd/le-nextboot-read-write.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Schedule next boot to Linux Educacional on system power on -After=local-fs.target -Before=sysinit.target -DefaultDependencies=no - -[Service] -Type=oneshot -ENvironmentFile=/etc/le-nextboot.conf -ExecStart=/bin/sh -c "${LE_NEXTBOOT_ENABLE} && grub-reboot ${LE_NEXTBOOT_INDEX}" - -[Install] -WantedBy=sysinit.target diff --git a/systemd/le-nextboot-reboot.service b/systemd/le-nextboot-reboot.service deleted file mode 100644 index 5cd53e6e7c50fec1e5ffd7ff62ced6b478ae284d..0000000000000000000000000000000000000000 --- a/systemd/le-nextboot-reboot.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Cancel scheduled boot to Linux Educacional -After=getty@tty1.service display-manager.service -Before=systemd-reboot.service -DefaultDependencies=no - -[Service] -Type=oneshot -ExecStart=/usr/sbin/grub-reboot 0 - -[Install] -WantedBy=reboot.target diff --git a/systemd/le-nextboot-read-write@.service b/systemd/userful-rescue-nextboot-read-write.service similarity index 51% rename from systemd/le-nextboot-read-write@.service rename to systemd/userful-rescue-nextboot-read-write.service index c8e2d7c93e5d5ae1879024bd26d1ab40957b2105..021118f0ae5b065695f1eb802c65df6f7d59cea5 100644 --- a/systemd/le-nextboot-read-write@.service +++ b/systemd/userful-rescue-nextboot-read-write.service @@ -1,12 +1,12 @@ [Unit] -Description=Schedule next boot to Linux Educacional on system power on +Description=Schedule next boot to Userful Rescue Live on system power on After=local-fs.target Before=sysinit.target DefaultDependencies=no [Service] Type=oneshot -ExecStart=/usr/sbin/grub-reboot %i +ExecStart=/usr/sbin/grub-reboot "Userful Rescue Live" [Install] WantedBy=sysinit.target diff --git a/systemd/userful-rescue-nextboot-reboot.service b/systemd/userful-rescue-nextboot-reboot.service new file mode 100644 index 0000000000000000000000000000000000000000..51968ef655a33c932bfe2bfe4059ba1308edee0c --- /dev/null +++ b/systemd/userful-rescue-nextboot-reboot.service @@ -0,0 +1,12 @@ +[Unit] +Description=Cancel scheduled boot to Userful Rescue Live +After=getty@tty1.service lightdm.service +Before=systemd-reboot.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/bin/grub-editenv - unset next_entry + +[Install] +WantedBy=reboot.target diff --git a/update-xorg-conf b/update-xorg-conf index 30c7fca71f327332eacfc4bf68c64f4b28371d46..c0658c9eae23542c0511892dc88c27c7b983952f 100755 --- a/update-xorg-conf +++ b/update-xorg-conf @@ -27,13 +27,17 @@ index=1 pattern="${1}" shift +# o lspci do fim do laço (entrada) descobre os barramentos da maquina atual while read -r line do + # substitui : por . address=$(echo "${line}" | awk '{ sub(/\./, ":", $1) } { print $1 }') echo VIDEO_ADDRESS_${index} = ${address} for xorgconf in "${@}" do + # atualiza busid no arquivo de configuração conforme o barramento da maquina atual + # sub coloca na sintaxe correta do xorg awk -v n=${index} -v address=${address} \ '$1 == "BusID" { if (++count == n) { diff --git a/userful-rescue-disable b/userful-rescue-disable new file mode 100755 index 0000000000000000000000000000000000000000..c2dda8f501a1e9ecf2b511ad5e78ff32f4387bd5 --- /dev/null +++ b/userful-rescue-disable @@ -0,0 +1,15 @@ +#!/bin/bash +if [ "$UID" -ne 0 ] +then + "Este comando deve ser executado como root!" + exit 1 +fi +read -r -p "O sistema irá reiniciar automaticamente. Deseja continuar? [s/N] " response +response=${response,,} +if [[ "$response" =~ ^(sim|s)$ ]] +then + systemctl start userful-rescue-nextboot-reboot.service + systemctl disable userful-rescue-nextboot-reboot.service + systemctl disable userful-rescue-nextboot-read-write.service + systemctl reboot +fi diff --git a/userful-rescue-enable b/userful-rescue-enable new file mode 100755 index 0000000000000000000000000000000000000000..6a0defc431ffef5a5262895940e4959a63650d2e --- /dev/null +++ b/userful-rescue-enable @@ -0,0 +1,15 @@ +#!/bin/bash +if [ "$UID" -ne 0 ] +then + "Este comando deve ser executado como root!" + exit 1 +fi +read -r -p "O computador irá desligar automaticamente. Deseja continuar? [s/N] " response +response=${response,,} +if [[ "$response" =~ ^(sim|s)$ ]] +then + systemctl enable userful-rescue-nextboot-reboot.service + systemctl enable userful-rescue-nextboot-read-write.service + systemctl start userful-rescue-nextboot-read-write.service + systemctl poweroff +fi diff --git a/userful/auto-reboot b/userful/auto-reboot deleted file mode 100755 index 6236dc435d9c7d0c7933f84829ff2567a051cd53..0000000000000000000000000000000000000000 --- a/userful/auto-reboot +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -timeout=10 -echo "Reiniciando em ${timeout} segundos..." -sleep ${timeout} -reboot diff --git a/userful/auto_login.conf b/userful/auto_login.conf deleted file mode 100644 index 3a5faf9cf0b179c41af8f37c6c43fe98fda8b35b..0000000000000000000000000000000000000000 --- a/userful/auto_login.conf +++ /dev/null @@ -1,5 +0,0 @@ -[STATION 1] -user=admin - -[USER admin] -reboot = "DISPLAY=%(x11_display)s xterm -e auto-reboot" diff --git a/xephyr-wrapper b/xephyr-wrapper index 615a0e2d4ae56620c3a21887cad47c9576c7bb3a..8fbc0693467268dade999d2a459da3f767324374 100755 --- a/xephyr-wrapper +++ b/xephyr-wrapper @@ -4,13 +4,18 @@ tries=10 export DISPLAY=${1} shift +# We've found that latest Xephyr may segfault on 64-bit systems +# if XVideo extension is enabled. +[ "$(uname -i)" = "x86_64" ] && no_xv="-noxv" + # This is a workaround for the case Xephyr is started before host Xorg # server is ready for connections, despite the socket activation. +# tenta 10 vezes. se nao der, nao deu for i in $(seq ${tries}) do if xset q >/dev/null 2>&1 then - exec Xephyr -dpi 96 -xkb-rules evdev -xkb-layout br -xkb-model abnt2 ${@} + exec Xephyr -dpi 96 -xkb-rules evdev -xkb-layout br -xkb-model abnt2 ${no_xv} ${@} fi done diff --git a/xorg-daemon b/xorg-daemon old mode 100755 new mode 100644 index fbd63428b78411e95eb4f51c7cea54f661a115ea..813c25a55afbdf6253796f0508e4cf2493820e59 --- a/xorg-daemon +++ b/xorg-daemon @@ -1,4 +1,8 @@ #!/bin/sh -num_cards=$(lspci | grep -c SM501) +# Conta quantas placas de video tem +num_cards=$(lspci | grep -c Silicon.Motion) +# Se nao for igual a 1 ou 2 sai com erro 2 [ ${num_cards} -ne 1 -a ${num_cards} -ne 2 ] && exit 2 + +# executa o X exec Xorg ${1} -seat __fake-seat-${num_cards}__ -dpms -s 0 -nocursor diff --git a/xorg/98-proinfo-monitores.conf b/xorg/98-proinfo-monitores.conf deleted file mode 100644 index 61d1a71d185c168f1309c3993304d98bf7507823..0000000000000000000000000000000000000000 --- a/xorg/98-proinfo-monitores.conf +++ /dev/null @@ -1,9 +0,0 @@ -Section "Monitor" - Identifier "VGA Monitor" - Option "Enable" "true" -EndSection - -Section "Monitor" - Identifier "LVDS Monitor" - Option "RightOf" "VGA Monitor" -EndSection diff --git a/xorg/99-proinfo-rural.conf b/xorg/99-proinfo-rural.conf deleted file mode 100644 index ea7840718a881102ca92047f8a04d7262fbc6ad1..0000000000000000000000000000000000000000 --- a/xorg/99-proinfo-rural.conf +++ /dev/null @@ -1,42 +0,0 @@ -Section "Device" - MatchSeat "__fake-seat-2__" - Identifier "ThinNetworks TN-502 PCI Video Card 1" - BusID "PCI:0:0:0" - Driver "siliconmotion" - Option "PanelSize" "1360x768" - Option "Dualhead" "true" - Option "monitor-LVDS" "LVDS Monitor" - Option "monitor-VGA" "VGA Monitor" -EndSection - -Section "Device" - MatchSeat "__fake-seat-2__" - Identifier "ThinNetworks TN-502 PCI Video Card 2" - BusID "PCI:0:0:0" - Driver "siliconmotion" - Option "PanelSize" "1360x768" - Option "Dualhead" "true" - Option "monitor-LVDS" "LVDS Monitor" - Option "monitor-VGA" "VGA Monitor" -EndSection - -Section "Screen" - MatchSeat "__fake-seat-2__" - Identifier "ThinNetworks TN-502 Screen 1" - Device "ThinNetworks TN-502 PCI Video Card 1" - DefaultDepth 16 -EndSection - -Section "Screen" - MatchSeat "__fake-seat-2__" - Identifier "ThinNetworks TN-502 Screen 2" - Device "ThinNetworks TN-502 PCI Video Card 2" - DefaultDepth 16 -EndSection - -Section "ServerLayout" - MatchSeat "__fake-seat-2__" - Identifier "ThinNetworks TN-502 Dual-Card Layout" - Screen 0 "ThinNetworks TN-502 Screen 1" - Screen 1 "ThinNetworks TN-502 Screen 2" -EndSection diff --git a/xorg/99-proinfo-urbano.conf b/xorg/99-proinfo-urbano.conf deleted file mode 100644 index 335919d49e4c83ca1f981bea5ab6ded8127ce3ee..0000000000000000000000000000000000000000 --- a/xorg/99-proinfo-urbano.conf +++ /dev/null @@ -1,17 +0,0 @@ -Section "Device" - MatchSeat "__fake-seat-1__" - Identifier "ThinNetworks TN-502 PCI Video Card" - BusID "PCI:0:0:0" - Driver "siliconmotion" - Option "PanelSize" "1360x768" - Option "Dualhead" "true" - Option "monitor-LVDS" "LVDS Monitor" - Option "monitor-VGA" "VGA Monitor" -EndSection - -Section "Screen" - MatchSeat "__fake-seat-1__" - Identifier "ThinNetworks TN-502 Screen" - Device "ThinNetworks TN-502 PCI Video Card" - DefaultDepth 16 -EndSection