Sample Header Ad - 728x90

Slackware(64) 14.2 + chroot + xfce4-session + audio + (NV-)GLX?

0 votes
1 answer
205 views
Just to make it easier to mount my Slackware 14.2 Installation, I put it on another partition (it's 32 Bits 100% real native). I can start xfce4-session like root user (but that is not the thing I need) : ![ch"root"](Image"]https://i.postimg.cc/SRJjVfm5/Xephyr-ch-ROOT.png) I need to know if someone can help me with the follow things 1 - Redirect audio to host, because ![i don't had any sound from chroot](https://i.postimg.cc/50ttNSQ0/chroot-sinaudio.png) 2 - Is possible use 3D,DRI with Nvidia ? I saw something on a Gentoo forum, but I don't understand it) ![Nvidia, 2D/3D possible?](https://i.postimg.cc/PJ3Y5qqG/chroot-sin3d.png) 3 - Hide some commands and/or outputs from my script : The lines are :
local being added to access control list

export DISPLAY=localhost:1 2>/dev/null

exit
and when I close the Xephyr window, this shows up afterwards:
-su: línea 3: $'\E[01mHP': no se encontró la orden
![chroot & xephyr](https://i.postimg.cc/nhptv8qW/chroot-ocultar-lineas.png) My script "slack32-chroot" content :
#!/usr/bin/env bash

echo '
Autor ----------------> Inukaze ( Venezuela )
Sitio ----------------> https://goo.gl/ij6WqW 
Correo-E -------------> bloginukaze@gmail.com
Licencia -------------> GPL 2
'
#Establecer mediante la variable "$OBJETIVO" 
#La particion con una distribucion a la cual se accedera mediante chroot
export OBJETIVO="/media/Slack32"

#Prevenir que se autoejecuten las funciones que se definiran despues
unset montar
unset desmontar
unset MensajeBase

#Establecer y definir funciones :
function MensajeBase()
{
echo -e "\nLa forma correcta de utilizar este guion es :\n$0 «montar» , «montar_xephyr» ó «desmontar», Por ejemplo : \n"
echo -e "$0 montar"
echo -e "$0 montar_xephyr"
echo -e "$0 desmontar\n"
}

function montar(){
#Preparar acceso para programas de entorno grafico :
export DISPLAY=:0.0 2>/dev/null
xhost + local 2>/dev/null

#Montar todo de una vez para una distro de 32 Bits (En este caso Slackware32 14.2) : 
mount --rbind /proc							"$OBJETIVO/proc"						; \
mount --make-rslave							"$OBJETIVO/proc"						; \
mount --rbind /sys								"$OBJETIVO/sys"							; \
mount --make-rslave							"$OBJETIVO/sys"							; \
mount --rbind /dev							"$OBJETIVO/dev"							; \
mount --make-rslave							"$OBJETIVO/dev"							; \
mount --rbind /run								"$OBJETIVO/run"							; \
mount --make-rslave							"$OBJETIVO/run"							; \
mount --rbind /tmp							"$OBJETIVO/tmp"							; \
mount --make-rslave							"$OBJETIVO/tmp"							; \
mount --bind /etc/fstab						"$OBJETIVO/etc/fstab"					; \
mount --bind /etc/hostname			"$OBJETIVO/etc/hostname"		; \
mount --bind /etc/hosts						"$OBJETIVO/etc/hosts"				; \
mount --bind /etc/resolv.conf			"$OBJETIVO/etc/resolv.conf"		; \

cat /dev/null
EOF

linux32 chroot									"$OBJETIVO"	/bin/bash -l				; \
umount -l											"$OBJETIVO"									; \
mount -a 2>/dev/null
}


function xephyr(){
#Copiar archivo de autorizacion X.Org :
rm -f "$OBJETIVO/home/inukaze/.Xauthority"
rm -f "$OBJETIVO/root/.Xauthority"
cp -f "/home/inukaze/.Xauthority" "$OBJETIVO/root/.Xauthority"
cp -f "/home/inukaze/.Xauthority" "$OBJETIVO/home/inukaze/.Xauthority"
chown inukaze:users "$OBJETIVO/home/inukaze/.Xauthority"

if [ ! -f "$OBJETIVO/etc/X11/Xwrapper.config" ] ; then
# Prevenir el error « /usr/libexec/Xorg.wrap: Only console users are allowed to run the X server »
echo '# Xwrapper.config (Debian X Window System server wrapper configuration file)
#
# This file was generated by the post-installation script of the x11-common
# package using values from the debconf database.
#
# See the Xwrapper.config(5) manual page for more information.
#
# This file is automatically updated on upgrades of the x11-common package
# *only* if it has not been modified since the last upgrade of that package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command as root:
#   dpkg-reconfigure x11-common
#allowed_users=console
allowed_users=anybody' | tee "$OBJETIVO/etc/X11/Xwrapper.config"
fi

#Preparar acceso para programas de entorno grafico :
export DISPLAY=:0.0 2>/dev/null
xhost + local 2>/dev/null

#Montar todo de una vez para una distro de 32 Bits (En este caso Slackware32 14.2) : 
mount --rbind /proc							"$OBJETIVO/proc"						; \
mount --make-rslave							"$OBJETIVO/proc"						; \
mount --rbind /sys								"$OBJETIVO/sys"							; \
mount --make-rslave							"$OBJETIVO/sys"							; \
mount --rbind /dev							"$OBJETIVO/dev"							; \
mount --make-rslave							"$OBJETIVO/dev"							; \
mount --rbind /run								"$OBJETIVO/run"							; \
mount --make-rslave							"$OBJETIVO/run"							; \
mount --rbind /tmp							"$OBJETIVO/tmp"							; \
mount --make-rslave							"$OBJETIVO/tmp"							; \
mount --bind /etc/fstab						"$OBJETIVO/etc/fstab"					; \
mount --bind /etc/hostname			"$OBJETIVO/etc/hostname"		; \
mount --bind /etc/hosts						"$OBJETIVO/etc/hosts"				; \
mount --bind /etc/resolv.conf			"$OBJETIVO/etc/resolv.conf"		; \

cat /dev/null
EOF

linux32 chroot									"$OBJETIVO"	/bin/bash -l		/dev/null &)
$(export DISPLAY=:1.0)
$(DISPLAY=:1 /usr/bin/xfce4-session -- :1 2>/dev/null)
EOT

umount -l											"$OBJETIVO"									; \
mount -a 2>/dev/null
}

function desmontar(){
# Desmontar
umount -l			"$OBJETIVO"							; \
mount -a 2>/dev/null
}


#Este guión necesita ser ejecutado como SuperUsuario
#o en su defecto con permisos administrativos suficientes
#Para montar / desmontar particiones.
if [ "$(whoami)" != root ]; then

	echo
	echo
	echo 'Por favor ejecuta este guion como SuperUsuario (root)'
	echo
	echo 'Utilize este guión bajo su Propio Riesgro'
	echo 'El Autor , o sea yo , no me hago responsable'
	echo 'de las consecuencias imprevistas que puedan'
	echo 'acontecer en tu sistema operativo'
	echo
else
# Proceder en caso de tener los permisos suficientes para montar/desmontar particiones :

#Si el usuario no pasa ningun parametro indicar como se usa este guion
			if [ -z "$1" ]; then
					MensajeBase
			fi

#Guion : Aqui se ha definido como se utilizara este guion correctamente para montar o desmontar la particion Objetivo
#Entrada : Cualquier palabra pasada por el parametro $1 sera convertida en minusculas
Entrada=$(echo "$1" | tr -s  '[:upper:]'  '[:lower:]')

			if [ "$Entrada" == "montar" ]; then
					montar
			fi

			if [ "$Entrada" == "xephyr" ]; then
					xephyr
			fi

			if [ "$Entrada" == "desmontar" ]; then
					desmontar
			fi

#Finalizar la condicion globar de requerir usar el SuperUsuario o en su defectos persmisos administrativos
#Para poder (des)montar particiones :
fi

#Finalizar este guion sin problemas :
exit 0 2>/dev/null
This is a copy from [LinuxQuestions.org](https://www.linuxquestions.org/questions/showthread.php?p=6309616#post6309616)
Asked by Inukaze (47 rep)
Dec 15, 2021, 04:32 AM
Last activity: Dec 18, 2021, 12:56 PM