removing old sabayonlive-tools packages and adding sabayonlive init script to the new one

git-svn-id: http://svn.sabayonlinux.org/overlay@1865 d7aec97c-591d-0410-af39-a8856400b30a
This commit is contained in:
(no author)
2007-12-18 11:53:28 +00:00
parent 824320210b
commit ece5d91f35
13 changed files with 2544 additions and 67 deletions
+39 -14
View File
@@ -110,14 +110,38 @@ AUX 1.7.1/xorg.conf 3890 RMD160 49e687482f1ad18867e98313f3d01f623cb52b7a SHA1 fb
MD5 61b94f669561bfd615f51f54c1c9d07e files/1.7.1/xorg.conf 3890
RMD160 49e687482f1ad18867e98313f3d01f623cb52b7a files/1.7.1/xorg.conf 3890
SHA256 cbf20892e2b2c07e2b2a748fee99df871436f1093a3d38ab028f16d0581dff6c files/1.7.1/xorg.conf 3890
EBUILD sabayonlive-tools-1.6.1.ebuild 1137 RMD160 403e0967a89e909a55cfbe546f7b814424f292a5 SHA1 27d5f22e3c2f9f0daaf723b79cbecef28a58e818 SHA256 bed8619f039c4c96bab645c1f3e30b5f0cc338bfa92973b6ea68c47f7b9a0d27
MD5 a46a94cca07c6885298731f6d533c018 sabayonlive-tools-1.6.1.ebuild 1137
RMD160 403e0967a89e909a55cfbe546f7b814424f292a5 sabayonlive-tools-1.6.1.ebuild 1137
SHA256 bed8619f039c4c96bab645c1f3e30b5f0cc338bfa92973b6ea68c47f7b9a0d27 sabayonlive-tools-1.6.1.ebuild 1137
EBUILD sabayonlive-tools-1.6.2.ebuild 1140 RMD160 a90b9427bfdc3715c546947c20c4626d1877cc3a SHA1 5d7defab74141ba36dd241f12d2bb8fd50ad117a SHA256 5ebef0a8340681502c08c7af7407985b60964a44db41e60d929810b5cc6213bd
MD5 014ee4ab07ed8c239b36b234789e3d42 sabayonlive-tools-1.6.2.ebuild 1140
RMD160 a90b9427bfdc3715c546947c20c4626d1877cc3a sabayonlive-tools-1.6.2.ebuild 1140
SHA256 5ebef0a8340681502c08c7af7407985b60964a44db41e60d929810b5cc6213bd sabayonlive-tools-1.6.2.ebuild 1140
AUX 1.7.2/bashlogin 133 RMD160 5c2aae2522427c3ff1d9260764b0ed20cd1a0909 SHA1 a57b9911d970d57d43b9d697af136e47137177f6 SHA256 7dbf15b68e436cd014b64779435afd4cfccd012e4889a86f955ef42a89278aad
MD5 9bdc85070df0e7b1aed3d02c5e2777c6 files/1.7.2/bashlogin 133
RMD160 5c2aae2522427c3ff1d9260764b0ed20cd1a0909 files/1.7.2/bashlogin 133
SHA256 7dbf15b68e436cd014b64779435afd4cfccd012e4889a86f955ef42a89278aad files/1.7.2/bashlogin 133
AUX 1.7.2/livecd-functions.sh 17609 RMD160 d8c04a34fd18f5b5abebcd2f76f7fc93fee2e53c SHA1 1af8738cabfb08e6414b5c064481a893e7f14b07 SHA256 fff774d8ad984d35026c872e56c8b76f6db4a16a369659f519cc94312d1c00bc
MD5 4ff2d5cd493def90aef53576aae47036 files/1.7.2/livecd-functions.sh 17609
RMD160 d8c04a34fd18f5b5abebcd2f76f7fc93fee2e53c files/1.7.2/livecd-functions.sh 17609
SHA256 fff774d8ad984d35026c872e56c8b76f6db4a16a369659f519cc94312d1c00bc files/1.7.2/livecd-functions.sh 17609
AUX 1.7.2/net-setup 1525 RMD160 bc9ecc263f7547a16efa7acc279d186fc56925d7 SHA1 718a7f8f5a5912e32a41701c6a90caf94bbe3027 SHA256 2356972db6ed044e74c4fc91cc7ef19f678aac3cf149f48fcde88922d7531468
MD5 60df251e1ea9ee478ed3bd7dd85c6404 files/1.7.2/net-setup 1525
RMD160 bc9ecc263f7547a16efa7acc279d186fc56925d7 files/1.7.2/net-setup 1525
SHA256 2356972db6ed044e74c4fc91cc7ef19f678aac3cf149f48fcde88922d7531468 files/1.7.2/net-setup 1525
AUX 1.7.2/opengl-activator 9886 RMD160 757e7689224332cffb96a16dc902d96f88612c16 SHA1 c4a3190f62f3d81546f27b4e81bf8bb73842c1d3 SHA256 61c2c230f4ab9092cbd222f090c288029e3215029b26a81b9bd04397650828c7
MD5 4c8f7c303fd0c5c1a48b9e3fb18b3326 files/1.7.2/opengl-activator 9886
RMD160 757e7689224332cffb96a16dc902d96f88612c16 files/1.7.2/opengl-activator 9886
SHA256 61c2c230f4ab9092cbd222f090c288029e3215029b26a81b9bd04397650828c7 files/1.7.2/opengl-activator 9886
AUX 1.7.2/sabayonlive 33878 RMD160 df3b77e123ee3e91df9e19ebf8bd79e702f7fe8a SHA1 a87340b6fd56b5980729c9d4ed99fb57af86172c SHA256 3e923f6c24ea3f01a5dedb0f136892a020d59cbdea227469a4d306bf5daceac4
MD5 7cabd38ed90beea2ec65016b27dbe01f files/1.7.2/sabayonlive 33878
RMD160 df3b77e123ee3e91df9e19ebf8bd79e702f7fe8a files/1.7.2/sabayonlive 33878
SHA256 3e923f6c24ea3f01a5dedb0f136892a020d59cbdea227469a4d306bf5daceac4 files/1.7.2/sabayonlive 33878
AUX 1.7.2/x-setup-configuration 11844 RMD160 0a380d242461fe405481d03ed72b747e031a6167 SHA1 c6be9b847d3f630f43dac830a2eff9a8a7a7e223 SHA256 94db8b84b1d26a99dba22114ade10a9a787f2173685bba57846e5fd4f4b49bee
MD5 0a3b268df5862a3c59ab5ff98d50c4d0 files/1.7.2/x-setup-configuration 11844
RMD160 0a380d242461fe405481d03ed72b747e031a6167 files/1.7.2/x-setup-configuration 11844
SHA256 94db8b84b1d26a99dba22114ade10a9a787f2173685bba57846e5fd4f4b49bee files/1.7.2/x-setup-configuration 11844
AUX 1.7.2/x-setup-init.d 1330 RMD160 09c155ffe3aa9a65760bdef8cece2737ccc9c6c3 SHA1 11982feb8b32cd30ac972767f0c8094220e5c1c6 SHA256 bfbbdafc69b24274791bd412d223f8bc2c443cf942cfd3b989bc23916f9833ad
MD5 20c133ce4880abc538c7989920f3534c files/1.7.2/x-setup-init.d 1330
RMD160 09c155ffe3aa9a65760bdef8cece2737ccc9c6c3 files/1.7.2/x-setup-init.d 1330
SHA256 bfbbdafc69b24274791bd412d223f8bc2c443cf942cfd3b989bc23916f9833ad files/1.7.2/x-setup-init.d 1330
AUX 1.7.2/xorg.conf 3890 RMD160 49e687482f1ad18867e98313f3d01f623cb52b7a SHA1 fbcd39fe95d98f55892fbe46db49cac203c83e76 SHA256 cbf20892e2b2c07e2b2a748fee99df871436f1093a3d38ab028f16d0581dff6c
MD5 61b94f669561bfd615f51f54c1c9d07e files/1.7.2/xorg.conf 3890
RMD160 49e687482f1ad18867e98313f3d01f623cb52b7a files/1.7.2/xorg.conf 3890
SHA256 cbf20892e2b2c07e2b2a748fee99df871436f1093a3d38ab028f16d0581dff6c files/1.7.2/xorg.conf 3890
EBUILD sabayonlive-tools-1.7.0.ebuild 1140 RMD160 a90b9427bfdc3715c546947c20c4626d1877cc3a SHA1 5d7defab74141ba36dd241f12d2bb8fd50ad117a SHA256 5ebef0a8340681502c08c7af7407985b60964a44db41e60d929810b5cc6213bd
MD5 014ee4ab07ed8c239b36b234789e3d42 sabayonlive-tools-1.7.0.ebuild 1140
RMD160 a90b9427bfdc3715c546947c20c4626d1877cc3a sabayonlive-tools-1.7.0.ebuild 1140
@@ -126,15 +150,16 @@ EBUILD sabayonlive-tools-1.7.1-r1.ebuild 1140 RMD160 a90b9427bfdc3715c546947c20c
MD5 014ee4ab07ed8c239b36b234789e3d42 sabayonlive-tools-1.7.1-r1.ebuild 1140
RMD160 a90b9427bfdc3715c546947c20c4626d1877cc3a sabayonlive-tools-1.7.1-r1.ebuild 1140
SHA256 5ebef0a8340681502c08c7af7407985b60964a44db41e60d929810b5cc6213bd sabayonlive-tools-1.7.1-r1.ebuild 1140
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-sabayonlive-tools-1.6.1 0
RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-sabayonlive-tools-1.6.1 0
SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-sabayonlive-tools-1.6.1 0
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-sabayonlive-tools-1.6.2 0
RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-sabayonlive-tools-1.6.2 0
SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-sabayonlive-tools-1.6.2 0
EBUILD sabayonlive-tools-1.7.2.ebuild 1202 RMD160 76f426092d3d7c08d2452b69d24bb3282c053686 SHA1 1ef730f9ce62305c82f82db27a0eeb5d2f61b483 SHA256 5a85a35bdea8de5ec76a0a01798ba0167649d0f401c69470e389b9d621aeb941
MD5 b7f0a00346bd02bc5e5db7cb58aeda36 sabayonlive-tools-1.7.2.ebuild 1202
RMD160 76f426092d3d7c08d2452b69d24bb3282c053686 sabayonlive-tools-1.7.2.ebuild 1202
SHA256 5a85a35bdea8de5ec76a0a01798ba0167649d0f401c69470e389b9d621aeb941 sabayonlive-tools-1.7.2.ebuild 1202
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-sabayonlive-tools-1.7.0 0
RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-sabayonlive-tools-1.7.0 0
SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-sabayonlive-tools-1.7.0 0
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-sabayonlive-tools-1.7.1-r1 0
RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-sabayonlive-tools-1.7.1-r1 0
SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-sabayonlive-tools-1.7.1-r1 0
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-sabayonlive-tools-1.7.2 0
RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-sabayonlive-tools-1.7.2 0
SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-sabayonlive-tools-1.7.2 0
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
cat /etc/motd 2>/dev/null
cd /root
[[ -e .bash_profile ]] && source .bash_profile
kbdrate -s -r 25
exec -l /bin/bash -i
+638
View File
@@ -0,0 +1,638 @@
#!/bin/bash
# Global Variables:
# CDBOOT -- is booting off CD
# LIVECD_CONSOLE -- console that is specified to kernel commandline
# -- (ttyS0, tty1, etc). Only defined if passed to kernel
# LIVECD_CONSOLE_BAUD -- console baudrate specified
# LIVECD_CONSOLE_PARITY -- console parity specified
# LIVECD_CONSOLE_DATABITS -- console databits specified
[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh
livecd_parse_opt() {
case "$1" in
*\=*)
echo "$1" | cut -f2 -d=
;;
esac
}
livecd_check_root() {
if [ "$(whoami)" != "root" ]
then
echo "ERROR: must be root to continue"
return 1
fi
}
livecd_get_cmdline() {
echo "0" > /proc/sys/kernel/printk
CMDLINE="$(cat /proc/cmdline)"
export CMDLINE
}
no_gl() {
# einfo "If you have a card that you know is supported by either the ATI or"
# einfo "NVIDIA binary drivers, please file a bug with the output of lspci"
# einfo "on http://bugs.gentoo.org so we can resolve this."
GLTYPE=xorg-x11
}
ati_gl() {
einfo "ATI card detected."
if [ -e /usr/lib/xorg/modules/drivers/fglrx_drv.so ] \
|| [ -e /usr/lib/modules/drivers/fglrx_drv.so ]
then
GLTYPE=ati
else
GLTYPE=xorg-x11
fi
}
nv_gl() {
einfo "NVIDIA card detected."
if [ -e /usr/lib/xorg/modules/drivers/nvidia_drv.so ] \
|| [ -e /usr/lib/modules/drivers/nvidia_drv.so ]
then
GLTYPE=nvidia
else
GLTYPE=xorg-x11
fi
}
nv_no_gl() {
einfo "NVIDIA card detected."
echo
if [ -e /usr/lib/xorg/modules/drivers/nvidia_drv.so ] \
|| [ -e /usr/lib/modules/drivers/nvidia_drv.so ]
then
einfo "This card is not supported by the latest version of the NVIDIA"
einfo "binary drivers. Switching to the X server's driver instead."
fi
GLTYPE=xorg-x11
sed -i 's/nvidia/nv/' /etc/X11/xorg.conf
}
get_video_cards() {
[ -x /sbin/lspci ] && VIDEO_CARDS="$(/sbin/lspci | grep ' VGA ')"
[ -x /usr/sbin/lspci ] && VIDEO_CARDS="$(/usr/sbin/lspci | grep ' VGA ')"
#NUM_CARDS="$(echo ${VIDEO_CARDS} | wc -l)"
#if [ ${NUM_CARDS} -eq 1 ] # Disabled to support NVIDIA SLI devices
#then
NVIDIA=$(echo ${VIDEO_CARDS} | grep -i "nVidia Corporation")
ATI=$(echo ${VIDEO_CARDS} | grep -i "ATI Technologies")
if [ -n "${NVIDIA}" ]
then
# Always set NVIDIA OpenGL, since it's stupid doing the contrary because:
# there's no X.Org free driver that supports OpenGL through MESA
nv_gl
#NVIDIA_CARD=$(echo ${NVIDIA} | awk 'BEGIN {RS=" "} /(NV|nv|G|C)[0-9]+/ {print $1}' | cut -d. -f1 | sed 's/ //' | sed 's:[^0-9]::g')
# NVIDIA Model reference:
# http://en.wikipedia.org/wiki/Comparison_of_NVIDIA_Graphics_Processing_Units
#if [ -n "${NVIDIA_CARD}" ]
#then
# if [ $(echo ${NVIDIA_CARD} | cut -dV -f2) -ge 17 ]
# then
# nv_gl
# elif [ $(echo ${NVIDIA_CARD} | cut -dG -f2) -ge 70 ]
# then
# nv_gl
# elif [ $(echo ${NVIDIA_CARD} | cut -dV -f2) -eq 11 ]
# then
# nv_gl
# elif [ $(echo ${NVIDIA_CARD} | cut -dC -f2) -ge 50 ]
# then
# nv_gl
# else
# no_gl
# fi
#else
# no_gl
#fi
elif [ -n "${ATI}" ]
then
ATI_CARD=$(echo ${ATI} | awk 'BEGIN {RS=" "} /(R|RV|RS|M)[0-9]+/ {print $1}')
if [ $(echo ${ATI_CARD} | grep S) ]
then
ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dS -f2)
elif [ $(echo ${ATI_CARD} | grep V) ]
then
ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dV -f2)
elif [ $(echo ${ATI_CARD} | grep M) ]
then
# ATI Technologies Inc. M52 [ ATI Mobility Radeon X1300 ]
ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dM -f2)
else
ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dR -f2)
fi
if [ -n "${ATI_CARD_OUT}" ] && [ ${ATI_CARD_OUT} -ge 300 ]
then
ati_gl
elif [ -n "${ATI_CARD_OUT}" ] && [ -n "`echo ${ATI_CARD} | grep M`" ]
then
# this is an ATI Mxx card
ati_gl
# >8.29.6 does not support R200 anymore
elif [ -n "${ATI_CARD_OUT}" ] && [ ${ATI_CARD_OUT} -ge 200 ]
then
no_gl
else
# set ATI OpenGL anyway
ati_gl
fi
else
no_gl
fi
#fi
}
livecd_config_wireless() {
cd /tmp/setup.opts
[ -x /usr/sbin/iwconfig ] && iwconfig=/usr/sbin/iwconfig
[ -x /sbin/iwconfig ] && iwconfig=/sbin/iwconfig
dialog --title "SSID" --inputbox "Please enter your SSID, or leave blank for selecting the nearest open network" 20 50 2> ${iface}.SSID
SSID="$(cat ${iface}.SSID)"
if [ -n "${SSID}" ]
then
dialog --title "WEP (Part 1)" --menu "Does your network use encryption?" 20 60 7 1 "Yes" 2 "No" 2> ${iface}.WEP
WEP="$(cat ${iface}.WEP)"
case ${WEP} in
1)
dialog --title "WEP (Part 2)" --menu "Are you entering your WEP key in HEX or ASCII?" 20 60 7 1 "HEX" 2 "ASCII" 2> ${iface}.WEPTYPE
WEP_TYPE="$(cat ${iface}.WEPTYPE)"
case ${WEP_TYPE} in
1)
dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in the form of XXXX-XXXX-XX for 64-bit or XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX for 128-bit" 20 50 2> ${iface}.WEPKEY
WEP_KEY="$(cat ${iface}.WEPKEY)"
if [ -n "${WEP_KEY}" ]
then
${iwconfig} ${iface} essid "${SSID}"
${iwconfig} ${iface} key "${WEP_KEY}"
fi
;;
2)
dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in ASCII form. This should be 5 or 13 characters for either 64-bit or 128-bit encryption, repectively" 20 50 2> ${iface}.WEPKEY
WEP_KEY="$(cat ${iface}.WEPKEY)"
if [ -n "${WEP_KEY}" ]
then
${iwconfig} ${iface} essid "${SSID}"
${iwconfig} ${iface} key "s:${WEP_KEY}"
fi
;;
esac
;;
2)
${iwconfig} ${iface} essid "${SSID}"
${iwconfig} ${iface} key off
;;
esac
fi
}
livecd_write_wireless_conf() {
cd /tmp/setup.opts
SSID="$(cat ${iface}.SSID)"
if [ -n "${SSID}" ]
then
echo "# This wireless configuration file was built by net-setup" > /etc/conf.d/wireless
WEP="$(cat ${iface}.WEPTYPE)"
case ${WEP} in
1)
WEP_TYPE="$(cat ${iface}.WEPTYPE)"
if [ -n "${WEP_TYPE}" ]
then
WEP_KEY="$(cat ${iface}.WEPKEY)"
if [ -n "${WEP_KEY}" ]
then
SSID_TRANS="$(echo ${SSID//[![:word:]]/_})"
case ${WEP_TYPE} in
1)
echo "key_${SSID_TRANS}=\"${WEP_KEY} enc open\"" >> /etc/conf.d/wireless
;;
2)
echo "key_${SSID_TRANS}=\"s:${WEP_KEY} enc open\"" >> /etc/conf.d/wireless
;;
esac
fi
fi
;;
2)
:
;;
esac
echo "preferred_aps=( \"${SSID}\" )" >> /etc/conf.d/wireless
echo "associate_order=\"forcepreferredonly\"" >> /etc/conf.d/wireless
fi
}
livecd_config_ip() {
cd /tmp/setup.opts
dialog --title "TCP/IP setup" --menu "You can use DHCP to automatically configure a network interface or you can specify an IP and related settings manually. Choose one option:" 20 60 7 1 "Use DHCP to auto-detect my network settings" 2 "Specify an IP address manually" 2> ${iface}.DHCP
DHCP="$(cat ${iface}.DHCP)"
case ${DHCP} in
1)
/sbin/dhclient -q -r -nw ${iface} &
;;
2)
dialog --title "IP address" --inputbox "Please enter an IP address for ${iface}:" 20 50 "192.168.1.1" 2> ${iface}.IP
IP="$(cat ${iface}.IP)"
BC_TEMP="$(echo $IP|cut -d . -f 1).$(echo $IP|cut -d . -f 2).$(echo $IP|cut -d . -f 3).255"
dialog --title "Broadcast address" --inputbox "Please enter a Broadcast address for ${iface}:" 20 50 "${BC_TEMP}" 2> ${iface}.BC
BROADCAST="$(cat ${iface}.BC)"
dialog --title "Network mask" --inputbox "Please enter a Network Mask for ${iface}:" 20 50 "255.255.255.0" 2> ${iface}.NM
NETMASK="$(cat ${iface}.NM)"
dialog --title "Gateway" --inputbox "Please enter a Gateway for ${iface} (hit enter for none:)" 20 50 2> ${iface}.GW
GATEWAY="$(cat ${iface}.GW)"
dialog --title "DNS server" --inputbox "Please enter a name server to use (hit enter for none:)" 20 50 2> ${iface}.DNS
DNS="$(cat ${iface}.DNS)"
/sbin/ifconfig ${iface} ${IP} broadcast ${BROADCAST} netmask ${NETMASK}
if [ -n "${GATEWAY}" ]
then
/sbin/route add default gw ${GATEWAY} dev ${iface} netmask 0.0.0.0 metric 1
fi
if [ -n "${DNS}" ]
then
dialog --title "DNS Search Suffix" --inputbox "Please enter any domains which you would like to search on DNS queries (hit enter for none:)" 20 50 2> ${iface}.SUFFIX
SUFFIX="$(cat ${iface}.SUFFIX)"
echo "nameserver ${DNS}" > /etc/resolv.conf
if [ -n "${SUFFIX}" ]
then
echo "search ${SUFFIX}" >> /etc/resolv.conf
fi
fi
;;
esac
}
livecd_write_net_conf() {
cd /tmp/setup.opts
echo "# Sabayon Linux static network configuration tool" > /etc/conf.d/net
DHCP="$(cat ${iface}.DHCP)"
case ${DHCP} in
1)
echo "config_${iface}=( \"dhcp\" )" >> /etc/conf.d/net
echo "dhcp_${iface}=\"nosendhost\"" >> /etc/conf.d/net
;;
2)
IP="$(cat ${iface}.IP)"
BROADCAST="$(cat ${iface}.BC)"
NETMASK="$(cat ${iface}.NM)"
GATEWAY="$(cat ${iface}.GW)"
DNS="$(cat ${iface}.DNS)"
DOMAIN="$(cat ${iface}.SUFFIX)"
if [ -n "${IP}" -a -n "${BROADCAST}" -a -n "${NETMASK}" ]
then
echo "config_${iface}=( \"${IP} broadcast ${BROADCAST} netmask ${NETMASK}\" )" >> /etc/conf.d/net
if [ -n "${GATEWAY}" ]
then
echo "routes_${iface}=( \"default via ${GATEWAY}\" )" >> /etc/conf.d/net
fi
if [ -n "${DNS}" ]
then
echo "dns_servers_${iface}=\"${DNS}\"" >> /etc/conf.d/net
fi
if [ -n "${DOMAIN}" ]
then
echo "dns_search_${iface}=\"${DOMAIN}\"" >> /etc/conf.d/net
fi
fi
;;
esac
}
get_ifmac() {
local iface=$1
# Example: 00:01:6f:e1:7a:06
cat /sys/class/net/${iface}/address
}
get_ifdriver() {
local iface=$1
# Example: ../../../bus/pci/drivers/forcedeth (wanted: forcedeth)
local if_driver="$(readlink /sys/class/net/${iface}/device/driver)"
basename ${if_driver}
}
get_ifbus() {
local iface=$1
# Example: ../../../bus/pci (wanted: pci)
# Example: ../../../../bus/pci (wanted: pci)
# Example: ../../../../../../bus/usb (wanted: usb)
local if_bus="$(readlink /sys/class/net/${iface}/device/bus)"
basename ${if_bus}
}
get_ifproduct() {
local iface=$1
local bus="$(get_ifbus ${iface})"
local if_pciaddr
local if_devname
local if_usbpath
local if_usbmanufacturer
local if_usbproduct
if [[ ${bus} == "pci" ]]; then
# Example: ../../../devices/pci0000:00/0000:00:0a.0 (wanted: 0000:00:0a.0)
# Example: ../../../devices/pci0000:00/0000:00:09.0/0000:01:07.0 (wanted: 0000:01:07.0)
if_pciaddr="$(readlink /sys/class/net/${iface}/device)"
if_pciaddr="$(basename ${if_pciaddr})"
# Example: 00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3)
# (wanted: nVidia Corporation CK804 Ethernet Controller)
if_devname="$(lspci -s ${if_pciaddr})"
if_devname="${if_devname#*: }"
if_devname="${if_devname%(rev *)}"
fi
if [[ ${bus} == "usb" ]]; then
if_usbpath="$(readlink /sys/class/net/${iface}/device)"
if_usbpath="/sys/class/net/${iface}/$(dirname ${if_usbpath})"
if_usbmanufacturer="$(< ${if_usbpath}/manufacturer)"
if_usbproduct="$(< ${if_usbpath}/product)"
[[ -n ${if_usbmanufacturer} ]] && if_devname="${if_usbmanufacturer} "
[[ -n ${if_usbproduct} ]] && if_devname="${if_devname}${if_usbproduct}"
fi
if [[ ${bus} == "ieee1394" ]]; then
if_devname="IEEE1394 (FireWire) Network Adapter";
fi
echo ${if_devname}
}
get_ifdesc() {
local iface=$1
desc="$(get_ifproduct ${iface})"
if [[ -n ${desc} ]]; then
echo $desc
return;
fi
desc="$(get_ifdriver ${iface})"
if [[ -n ${desc} ]]; then
echo $desc
return;
fi
desc="$(get_ifmac ${iface})"
if [[ -n ${desc} ]]; then
echo $desc
return;
fi
echo "Unknown"
}
show_ifmenu() {
local old_ifs="${IFS}"
local opts
IFS="
"
for ifname in $(/sbin/ifconfig -a | grep "^[^ ]"); do
ifname="${ifname%% *}"
[[ ${ifname} == "lo" ]] && continue
opts="${opts} ${ifname} '$(get_ifdesc ${ifname})'"
done
IFS="${old_ifs}"
if ! eval dialog --menu \"Please select the interface that you wish to configure from the list below:\" 0 0 0 $opts 2>iface; then
exit
fi
iface="$(< iface)"
}
show_ifconfirm() {
local iface=$1
local if_mac="$(get_ifmac ${iface})"
local if_driver="$(get_ifdriver ${iface})"
local if_bus="$(get_ifbus ${iface})"
local if_product="$(get_ifproduct ${iface})"
local text="Details for network interface ${iface} are shown below.\n\nInterface name: ${iface}\n"
[[ -n ${if_product} ]] && text="${text}Device: ${if_product}\n"
[[ -n ${if_mac} ]] && text="${text}MAC address: ${if_mac}\n"
[[ -n ${if_driver} ]] && text="${text}Driver: ${if_driver}\n"
[[ -n ${if_bus} ]] && text="${text}Bus type: ${if_bus}\n"
text="${text}\nIs this the interface that you wish to configure?"
if ! dialog --title "Interface details" --yesno "${text}" 15 70; then
result="no"
else
result="yes"
fi
}
livecd_console_settings() {
# scan for a valid baud rate
case "$1" in
300*)
LIVECD_CONSOLE_BAUD=300
;;
600*)
LIVECD_CONSOLE_BAUD=600
;;
1200*)
LIVECD_CONSOLE_BAUD=1200
;;
2400*)
LIVECD_CONSOLE_BAUD=2400
;;
4800*)
LIVECD_CONSOLE_BAUD=4800
;;
9600*)
LIVECD_CONSOLE_BAUD=9600
;;
14400*)
LIVECD_CONSOLE_BAUD=14400
;;
19200*)
LIVECD_CONSOLE_BAUD=19200
;;
28800*)
LIVECD_CONSOLE_BAUD=28800
;;
38400*)
LIVECD_CONSOLE_BAUD=38400
;;
57600*)
LIVECD_CONSOLE_BAUD=57600
;;
115200*)
LIVECD_CONSOLE_BAUD=115200
;;
esac
if [ "${LIVECD_CONSOLE_BAUD}" = "" ]
then
# If it's a virtual console, set baud to 38400, if it's a serial
# console, set it to 9600 (by default anyhow)
case ${LIVECD_CONSOLE} in
tty[0-9])
LIVECD_CONSOLE_BAUD=38400
;;
*)
LIVECD_CONSOLE_BAUD=9600
;;
esac
fi
export LIVECD_CONSOLE_BAUD
# scan for a valid parity
# If the second to last byte is a [n,e,o] set parity
local parity
parity=$(echo $1 | rev | cut -b 2-2)
case "$parity" in
[neo])
LIVECD_CONSOLE_PARITY=$parity
;;
esac
export LIVECD_CONSOLE_PARITY
# scan for databits
# Only set databits if second to last character is parity
if [ "${LIVECD_CONSOLE_PARITY}" != "" ]
then
LIVECD_CONSOLE_DATABITS=$(echo $1 | rev | cut -b 1)
fi
export LIVECD_CONSOLE_DATABITS
return 0
}
livecd_read_commandline() {
livecd_get_cmdline || return 1
for x in ${CMDLINE}
do
case "${x}" in
cdroot)
CDBOOT="yes"
export CDBOOT
;;
cdroot\=*)
CDBOOT="yes"
export CDBOOT
;;
console\=*)
local live_console
live_console=$(livecd_parse_opt "${x}")
# Parse the console line. No options specified if
# no comma
LIVECD_CONSOLE=$(echo ${live_console} | cut -f1 -d,)
if [ "${LIVECD_CONSOLE}" = "" ]
then
# no options specified
LIVECD_CONSOLE=${live_console}
else
# there are options, we need to parse them
local livecd_console_opts
livecd_console_opts=$(echo ${live_console} | cut -f2 -d,)
livecd_console_settings ${livecd_console_opts}
fi
export LIVECD_CONSOLE
;;
esac
done
return 0
}
livecd_fix_inittab() {
if [ "${CDBOOT}" = "" ]
then
return 1
fi
# Create a backup
cp -f /etc/inittab /etc/inittab.old
# Comment out current getty settings
sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab
sed -i -e '/^s[01]/ s/^/#/' /etc/inittab
# SPARC & HPPA console magic
if [ "${HOSTTYPE}" = "sparc" -o "${HOSTTYPE}" = "hppa" -o "${HOSTTYPE}" = "ppc64" ]
then
# Mount openprom tree for user debugging purposes
if [ "${HOSTTYPE}" = "sparc" ]
then
mount -t openpromfs none /proc/openprom
fi
# SPARC serial port A, HPPA mux / serial
if [ -c "/dev/ttyS0" ]
then
LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyS0 speed)
echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_BAUD} ttyS0 vt100" >> /etc/inittab
fi
# HPPA software PDC console (K-models)
if [ "${LIVECD_CONSOLE}" = "ttyB0" ]
then
mknod /dev/ttyB0 c 11 0
LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyB0 speed)
echo "b0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_BAUD} ttyB0 vt100" >> /etc/inittab
fi
# FB / STI console
if [ -c "/dev/vc/1" -o -c "/dev/tts/1" -o -c "/dev/tty2" ]
then
MODEL_NAME=$(cat /proc/cpuinfo |grep "model name"|sed 's/.*: //')
if [ "${MODEL_NAME}" = "UML" ]
then
for x in 0 1 2 3 4 5 6
do
echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin root tty${x}" >> /etc/inittab
done
else
for x in 1 2 3 4 5 6
do
echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin root tty${x}" >> /etc/inittab
done
fi
fi
if [ -c "/dev/hvc0" ]
then
einfo "Adding hvc console to inittab"
echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin 9600 hvc0 vt320" >> /etc/inittab
fi
# The rest...
else
if [ "${LIVECD_CONSOLE}" = "tty0" -o "${LIVECD_CONSOLE}" = "" ]
then
for x in 1 2 3 4 5 6
do
echo "c${x}:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty${x} linux" >> /etc/inittab
done
else
einfo "Adding ${LIVECD_CONSOLE} console to inittab"
echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_BAUD} ${LIVECD_CONSOLE} vt100" >> /etc/inittab
fi
fi
# EFI-based machines should automatically hook up their console lines
if dmesg | grep -q '^Adding console on'
then
dmesg | grep '^Adding console on' | while read x; do
line=`echo "$x" | cut -d' ' -f4`
id=e`echo "$line" | grep -o '.\{1,3\}$'`
[ "${line}" = "${LIVECD_CONSOLE}" ] && continue # already setup above
case "$x" in
*options\ \'[0-9]*) speed=`echo "$x" | sed "s/.*options '//; s/[^0-9].*//"` ;;
*) speed=9600 ;; # choose a default, only matters if it is serial
esac
echo "$id:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${speed} ${line} vt100" >> /etc/inittab
done
fi
# force reread of inittab
kill -HUP 1
return 0
}
+65
View File
@@ -0,0 +1,65 @@
#!/bin/bash
# Copyright 1999-2005 Gentoo Foundation
# Copyright 2006-2007 Fabio Erculiani
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo/src/livecd-tools/net-setup,v 1.19 2006/05/30 20:20:11 wolf31o2 Exp $
if [ -f /sbin/livecd-functions.sh ]
then
source /sbin/livecd-functions.sh
else
echo "ERROR: /sbin/livecd-functions.sh could not be loaded!"
exit 1
fi
if [ ! -x $(which dialog) ]
then
echo "ERROR: The dialog utility is required for net-setup. Exiting!"
exit 1
fi
livecd_check_root || exit 1
# Hide any potential error messages from the readlink/dirname/etc calls below
exec 2>/dev/null
if [ -z "${1}" ]
then
show_ifmenu
echo $iface
else
iface="${1}"
fi
[ ! -d /tmp/setup.opts ] && mkdir /tmp/setup.opts
cd /tmp/setup.opts
while true; do
show_ifconfirm $iface
[[ $result == "yes" ]] && break
show_ifmenu
done
# Show stderr again
exec 2>/dev/stderr
dialog --title "Network setup" --menu "This script is designed to setup both wired and wireless network settings. All questions below apply to the ${iface} interface only. Choose one option:" 20 60 7 1 "My network is wireless" 2 "My network is wired" 2> ${iface}.WIRED_WIRELESS
WIRED_WIRELESS="$(cat ${iface}.WIRED_WIRELESS)"
case ${WIRED_WIRELESS} in
1)
livecd_config_wireless
livecd_config_ip
livecd_write_wireless_conf
;;
2)
livecd_config_ip
;;
*)
exit 0
;;
esac
livecd_write_net_conf
echo "Type \"ifconfig\" to make sure the interface was configured correctly."
# vim: ts=4
+318
View File
@@ -0,0 +1,318 @@
#!/bin/sh
# Forked from eselect opengl Gentoo module - this is reaaaaaaaaaally faster
# this is used only at Live time, to avoid the use of Portage
# Copyright 2006-2008 Fabio Erculiani
# Our data
ENV_FILE="/etc/env.d/03opengl"
PREFIX="/usr"
DST_PREFIX="/usr"
USE_PROFILE_HEADERS="no"
ES_VALID_MULTILIB_DIRS="lib lib32 lib64"
# list_libdirs PUBLIC
# Returns a space separated list of libdirs available on this machine
list_libdirs() {
local dir libdirs
libdirs=""
for dir in ${ES_VALID_MULTILIB_DIRS} ; do
if grep -q "^/${dir}\(\|/\)$" /etc/ld.so.conf &> /dev/null ; then
libdirs=( ${libdirs[@]} ${dir} )
fi
done
if [[ -z ${libdirs[@]} ]] ; then
# Broken or non-existing ld.so.conf
libdirs=( /lib* )
libdirs=( ${libdirs[@]/\/lib/lib} )
fi
echo "${libdirs[@]}"
}
# has test list
# Return true if list contains test
has() {
local test=${1} item
shift
for item in $@ ; do
[[ ${item} == ${test} ]] && return 0
done
return 1
}
# is_function function PUBLIC
# Test whether function exists
is_function() {
[[ $(type -t "${1}" ) == "function" ]]
}
# is_number PUBLIC
# Returns true if and only if $1 is a positive whole number
is_number() {
[[ -n ${1} ]] && [[ -z ${1//[[:digit:]]} ]]
}
get_current_implementation() {
local ret
local ldpath=$(cat ${ENV_FILE} | grep LDPATH | cut -d'"' -f 2)
local opengl_profile=$(cat ${ENV_FILE} | grep OPENGL_PROFILE | cut -d'"' -f 2)
if [[ -n ${opengl_profile} ]] ; then
ret="${opengl_profile}"
elif [[ -n ${ldpath} ]] ; then
ret="${ldpath%%:*}"
ret="${ret##*opengl/}"
ret="${ret%/lib*}"
fi
echo ${ret}
}
get_implementations() {
local ret dir
for x in $(list_libdirs) ; do
for dir in "${PREFIX}/${x}"/opengl/* ; do
[[ -d ${dir} && $(basename "${dir}") != "global" ]] || continue
has $(basename "${dir}") ${ret} && continue
ret=${ret:+${ret} }$(basename "${dir}")
done
done
echo ${ret}
}
setup_lib_symlinks() {
local profile_libdir=${1}
local libdir=${2}
local file
local rootfile
mkdir -p "${libdir}" || echo "Failed to create ${libdir}"
pushd "${libdir}" &> /dev/null
# First remove old symlinks
for file in libGL{,core}.{a,so,la} ; do
if [[ -h ${file} ]] ; then
rm -f "${file}" || echo -q "Failed to delete ${file}"
fi
done
# Note that we don't do .so*, just .so on purpose. The
# loader knows to look in the profile dir, and the
# linked just needs the .so
for file in ${profile_libdir}/libGL{,core}.{so,a,la}; do
rootfile="${file}"
[[ -f ${file} ]] || continue
if [[ -f $(basename "${file}") ]] ; then
rm -f "$(basename "${file}")" || echo -q "Failed to delete ${libdir}/$(basename "${file}")"
fi
# Fix libtool archives (#48297)
if [[ ${file%.la} != ${file} ]] ; then
sed "s:${profile_libdir}:${libdir}:g" "${file}" > "$(basename "${file}")" || echo "Failed to create ${libdir}/$(basename "${file}")"
else
ln -s "${rootfile}" || echo "Failed to create ${libdir}/$(basename "${file}")"
fi
done
popd &> /dev/null
}
set_new_implementation() {
local gl_implem=${1}
local avail_implems=$(get_implementations)
# Set a sane umask... bug #83115
umask 022
if ! has ${gl_implem} ${avail_implems}; then
echo "Invalid profile selected."
exit 1
fi
echo -n "Switching to ${gl_implem} OpenGL interface..."
local libdir
for libdir in $(list_libdirs); do
[[ ${ROOT} != / ]] && libdir=${libdir//${ROOT}}
# Special case handling of lib32 because it can be a symlink to
# emul libs
# Kill this special case once amd64's 2004.3 crap is gone =) --eradicator
if [[ ${libdir} = "lib32" ]] ; then
[[ -d ${PREFIX}/${libdir}/opengl ]] || continue
else
[[ -d ${PREFIX}/${libdir}/opengl && ! -h ${PREFIX}/${libdir} ]] || continue
fi
# Fallback on xorg-x11 if we don't have this implementation for this libdir.
local gl_local
if [[ ! -d ${PREFIX}/${libdir}/opengl/"${gl_implem}" ]] ; then
gl_local="xorg-x11"
else
gl_local="${gl_implem}"
fi
setup_lib_symlinks "${PREFIX}/${libdir}/opengl/${gl_local}/lib" "${DST_PREFIX}/${libdir}"
if [[ -e ${PREFIX}/${libdir}/opengl/${gl_local}/lib/tls ]] ; then
setup_lib_symlinks "${PREFIX}/${libdir}/opengl/${gl_local}/lib/tls" "${DST_PREFIX}/${libdir}/tls"
fi
local moduledir
if [[ -e ${DST_PREFIX}/${libdir}/xorg/modules ]] ; then
moduledir="xorg/modules"
else
moduledir="modules"
fi
if [[ -e ${PREFIX}/${libdir}/opengl/${gl_local}/extensions ]] ; then
mkdir -p "${DST_PREFIX}/${libdir}/${moduledir}/extensions" || echo "Failed to create ${DST_PREFIX}/${libdir}/${moduledir}/extensions"
pushd "${DST_PREFIX}/${libdir}/${moduledir}/extensions" &> /dev/null
# First remove old symlinks
for file in libglx.so libglx.a; do
if [[ -h ${file} ]] ; then
rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/${libdir}/${moduledir}/extensions/${file}"
fi
done
for file in ${PREFIX}/${libdir}/opengl/${gl_local}/extensions/*.{so,a,la}; do
[[ -f ${file} ]] || continue
if [[ -f $(basename "${file}") ]] ; then
rm -f "$(basename "${file}")" || echo "Failed to delete ${DST_PREFIX}/${libdir}/${moduledir}/extensions/$(basename "${file}")"
fi
# Fix libtool archives (#48297)
if [[ ${file%.la} != ${file} ]] ; then
sed "s:${PREFIX}/[^/]*/opengl/[^/]*/lib:${DST_PREFIX}/${libdir}:g" "${file}" > "$(basename "${file}")" || echo "Failed to create ${DST_PREFIX}/${libdir}/${moduledir}/extensions/$(basename "${file}")"
else
ln -s "${file}" || echo "Failed to create ${libdir}/$(basename "${file}")"
fi
done
popd &> /dev/null
fi
# Setup the includes
mkdir -p "${DST_PREFIX}/include/GL" || echo "Failed to create ${DST_PREFIX}/include/GL"
pushd "${DST_PREFIX}/include/GL" &> /dev/null
for file in gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h; do
# IMPORTANT
# It is preferable currently to use the standard glext.h file
# however if an OpenGL provider must use a self produced glext.h
# then it should be installed to ${gl_implem}/include and the user
# can add the --impl-headers option to select it.
if [[ "${USE_PROFILE_HEADERS}" == "yes" ]] ; then
# Check the profile first.
if [[ -e ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} ]] ; then
if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then
rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")"
fi
ln -s ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} || echo "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")"
continue
fi
fi
if [[ -e ${PREFIX}/${libdir}/opengl/global/include/${file} ]] ; then
if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then
rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")"
fi
ln -s ${PREFIX}/${libdir}/opengl/global/include/${file} || echo "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")"
elif [[ -e ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} ]] ; then
if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then
rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")"
fi
ln -s ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} || echo "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")"
elif [[ -e ${PREFIX}/${libdir}/opengl/xorg-x11/include/${file} ]] ; then
if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then
rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")"
fi
ln -s ${PREFIX}/${libdir}/opengl/xorg-x11/include/${file} || echo "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")"
fi
done
popd &> /dev/null
# Setup the $LDPATH
ldpath="${ldpath:+${ldpath}:}${PREFIX}/${libdir}/opengl/${gl_local}/lib"
done
sed -i '/LDPATH=.*/d' ${ENV_FILE}
echo "LDPATH=\"${ldpath}\"" >> ${ENV_FILE}
oldldpath=$(cat /etc/profile.env|grep LDPATH | cut -d"'" -f2)
sed -i '/export LDPATH=.*/d' /etc/profile.env
echo "export LDPATH='"${ldpath}":"${oldldpath}"'" >> /etc/profile.env
echo "export LD_LIBRARY_PATH='"${ldpath}"'" >> /etc/profile.env
sed -i '/LD_LIBRARY_PATH=.*/d' ${ENV_FILE}
echo 'LD_LIBRARY_PATH="'${ldpath}'"' >> ${ENV_FILE}
sed -i "s/OPENGL_PROFILE=.*/OPENGL_PROFILE=\"${gl_implem}\"/" ${ENV_FILE}
sed -i "s/OPENGL_PROFILE=.*/OPENGL_PROFILE='${gl_implem}'/" /etc/profile.env
source /etc/profile &> /dev/null
echo " done"
}
do_set() {
local action="error"
local current=$(get_current_implementation)
local available=$(get_implementations)
local new
while [[ ${#@} -gt 0 ]] ; do
local opt=${1}
shift
case ${opt} in
*)
action="set-implementation"
if has ${opt} ${available}; then
new="${opt}"
else
echo "Unrecognized option: ${opt}"
fi
;;
esac
done
case ${action} in
set-implementation)
if [[ -n ${new} ]] ; then
set_new_implementation ${new}
sed -i "s/opengl\/xorg-x11\//opengl\/${new}\//" /etc/ld.so.conf
sed -i "s/opengl\/ati\//opengl\/${new}\//" /etc/ld.so.conf
sed -i "s/opengl\/nvidia\//opengl\/${new}\//" /etc/ld.so.conf
#nice -20 ldconfig -X &> /dev/null
return $?
else
echo "Please specify an implementation to set"
fi
;;
*)
echo "Invalid usage of set action."
;;
esac
}
do_show() {
local current=$(get_current_implementation)
echo ${current}
}
is_live=$(cat /proc/cmdline | grep cdroot)
if [ -n "$is_live" ]; then
if [ "$1" == "show" ]; then
do_show
else
do_set $@
fi
else
if [ "$1" == "show" ]; then
eselect opengl show
else
eselect opengl set $@
fi
fi
+970
View File
@@ -0,0 +1,970 @@
#!/sbin/runscript
# Copyright 2004-2007 Fabio Erculiani
# Distributed under the terms of the GNU General Public License v2
depend() {
before xdm
after alsasound
before splash
}
start_acceleration_manager() {
source /etc/profile
cmdline_xgl_exist=$(cat /proc/cmdline | grep " xgl")
cmdline_aiglx_exist=$(cat /proc/cmdline | grep " aiglx")
cmdline_noaccelmanager_exist=$(cat /proc/cmdline | grep " noaccelmanager")
# Configure XGL ?
if [ -n "$cmdline_xgl_exist" ]; then
#echo -en "\E[33;36m * \E[0m \E[01;32m Configuring the system for XGL... \E[0m"
/sbin/xgl-setup enable &> /dev/null
#echo -e "Done"
killall ogg123 &> /dev/null
rm -rf /var/tmp/music.ogg &> /dev/null
fi
# Configure AIGLX ?
if [ -n "$cmdline_aiglx_exist" ] && [ -z "$cmdline_xgl_exist" ]; then
#echo -en "\E[33;36m * \E[0m \E[01;32m Configuring the system for AIGLX... \E[0m"
/sbin/aiglx-setup enable &> /dev/null
#echo -e "Done"
killall ogg123 &> /dev/null
rm -rf /var/tmp/music.ogg &> /dev/null
fi
# Start-up accel-manager - this must be always after gpu-configuration
if [ -z "$cmdline_noaccelmanager_exist" ] && [ -z "$cmdline_xgl_exist" ] && [ -z "$cmdline_aiglx_exist" ]; then
# ok, no xgl,aiglx and noaccelmanager parameters at boot. start the app
cmdline_nox_exist=$(cat /proc/cmdline | grep " nox")
cmdline_installer_gui_exist=$(cat /proc/cmdline | grep " installer-gui")
cmdline_installer_text_exist=$(cat /proc/cmdline | grep " installer-text")
cmdline_mediacenter_exist=$(cat /proc/cmdline | grep "mediacenter")
cmdline_game_exist=$(cat /proc/cmdline | grep " sabayon-game=")
cmdline_coldwar_exist=$(cat /proc/cmdline | grep " coldwar")
cmdline_vesaonly_exist=$(cat /proc/cmdline | grep "vesaonly")
if [ -z "$cmdline_nox_exist" ] && [ -z "$cmdline_installer_gui_exist" ] && [ -z "$cmdline_installer_text_exist" ] && [ -z "$cmdline_mediacenter_exist" ] && [ -z "$cmdline_game_exist" ] && [ -z "$cmdline_vesaonly_exist" ]; then
# Start KDM restarter check
start-stop-daemon --start --background --exec /usr/share/accel-manager/accel-server-handler
/usr/share/accel-manager/desktop-accel-selector &> /dev/null
else
killall ogg123 &> /dev/null
rm -rf /var/tmp/music.ogg &> /dev/null
fi
else
start-stop-daemon --start --exec /sbin/ldconfig --
fi
if [ -n "$cmdline_noaccelmanager_exist" ]; then
killall ogg123 &> /dev/null
rm -rf /var/tmp/music.ogg &> /dev/null
fi
}
prepare_fluxbox_locked_autologin() {
# change default wm to fluxbox
echo "[Desktop]" > /home/sabayonuser/.dmrc
echo "Session=fluxbox" >> /home/sabayonuser/.dmrc
chown sabayonuser /home/sabayonuser/.dmrc
# Set KDM Autologin and scramble root/sabayonuser passwords
#AutoLoginEnable=true
sed -i 's/AutoLoginEnable=.*/AutoLoginEnable=true/' /usr/kde/3.5/share/config/kdm/kdmrc
#AutoLoginUser=sabayonuser
sed -i 's/AutoLoginUser=.*/AutoLoginUser=sabayonuser/' /usr/kde/3.5/share/config/kdm/kdmrc
sed -i 's/AutoLoginDelay=.*/AutoLoginDelay=0/' /usr/kde/3.5/share/config/kdm/kdmrc
# Change passwords for security
echo root:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1
echo sabayonuser:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1
}
start() {
# Kept for compatibility and for SLI
if [ ! -e "/mnt/gentoo" ];then
mkdir /mnt/gentoo > /dev/null
fi
# Copy sabayonuser directory
rm -rf /home/sabayonuser
cp /etc/skel /home/sabayonuser -Rp
chown sabayonuser:users /home/sabayonuser -R
# Disable memory eating services
rm -f /usr/share/autostart/skim.desktop
rm -f /usr/share/autostart/kerry.autostart.desktop
rm -f /usr/share/autostart/kbluetooth.autostart.desktop
rm -f /usr/share/autostart/beagled.desktop
# Remove broken entries in /etc/mtab
sed -i '/.*newroot.*/d' /etc/mtab
# Try to fix 8139cp and 8139too problems
is_8139_loaded=$(lsmod | grep 8139cp || lsmod | grep 8139too)
if [ -n "$is_8139_loaded" ]; then
# Yes it is
are_there_problems_with_8139cp=$(dmesg | grep -i 'Try the "8139too" driver instead')
are_there_problems_with_8139too=$(dmesg | grep -i 'Try the "8139cp" driver instead')
if [ -n "$are_there_problems_with_8139cp" ]; then
rmmod 8139cp
echo "blacklist 8139cp" >> /etc/modules.d/blacklist
modprobe 8139too
fi
if [ -n "$are_there_problems_with_8139too" ]; then
rmmod 8139too
echo "blacklist 8139too" >> /etc/modules.d/blacklist
modprobe 8139cp
fi
fi
# collect network devices
dev_list=$(cat /proc/net/dev | awk '{ print $1 }' | egrep '^(eth|ath|wlan|ppp|ra)' | cut -d: -f1 | sed -e :a -e '$!N;s/\n/ /')
cmdline_nodhcp_exist=$(cat /proc/cmdline | grep nodhcp)
if [ -n "$cmdline_nodhcp_exist" ]; then
# write config for network devices
for word in $dev_list; do
echo "config_$word=( \"dhcp\" )" >> /etc/conf.d/net
echo "dhclient_$word=\"-t 10\"" >> /etc/conf.d/net
done
fi
#===============================================================)
# insmod and rmmod: )
#===============================================================)
cmdline_rmmod_exist=$(cat /proc/cmdline | grep rmmod=)
if [ -n "$cmdline_rmmod_exist" ];then
for word in `cat /proc/cmdline` ; do
case $word in
rmmod=*)
rmmod_toset=$(echo $word | cut -d "=" -f 2)
rmmod_comma_separated=$(echo $rmmod_toset | grep ",")
if [ -n "$rmmod_comma_separated" ]; then
while [ "`echo $rmmod_toset | grep ','`" != "" ]; do
rmmod_toset=$(echo $rmmod_toset | sed 's/,/ /')
done
for word2 in $rmmod_toset; do
rmmod $word2 &> /dev/null
echo -e "\E[33;36m * \E[0m\E[01;32m Removing kernel module: "$word2 "\E[0m"
done
else
rmmod $rmmod_toset &> /dev/null
echo -e "\E[33;36m * \E[0m\E[01;32m Removing kernel module: "$insmod_toset "\E[0m"
fi
;;
esac
done
fi
cmdline_insmod_exist=$(cat /proc/cmdline | grep insmod=)
if [ -n "$cmdline_insmod_exist" ];then
for word in `cat /proc/cmdline` ; do
case $word in
insmod=*)
insmod_toset=$(echo $word | cut -d "=" -f 2)
insmod_comma_separated=$(echo $insmod_toset | grep ",")
if [ -n "$insmod_comma_separated" ]; then
while [ "`echo $insmod_toset | grep ','`" != "" ]; do
insmod_toset=$(echo $insmod_toset | sed 's/,/ /')
done
for word2 in $insmod_toset; do
modprobe $word2 &> /dev/null
echo -e "\E[33;36m * \E[0m\E[01;32m Loading kernel module: "$word2 "\E[0m"
done
else
modprobe $insmod_toset &> /dev/null
echo -e "\E[33;36m * \E[0m\E[01;32m Loading kernel module: "$insmod_toset "\E[0m"
fi
;;
esac
done
fi
#===============================================================)
# Restore audio volumes )
#===============================================================)
cmdline_mute_exists=$(cat /proc/cmdline | grep "sound=mute")
if [ -z "$cmdline_mute_exists" ] && [ ! -e "/etc/amixer_has_been_run" ]; then
/usr/bin/amixer -q set Master 70% unmute &> /dev/null
/usr/bin/amixer -q set PCM 70% unmute &> /dev/null
/usr/bin/amixer -q set Front 70% unmute &> /dev/null
/usr/bin/amixer -q set Surround 70% unmute &> /dev/null
/usr/bin/amixer -q set Center 70% unmute &> /dev/null
/usr/bin/amixer -q set LFE 70% unmute &> /dev/null
/usr/bin/amixer -q set "Analog Mix" 70% unmute &> /dev/null
/usr/bin/amixer -q set "Aux" 70% unmute &> /dev/null
/usr/bin/amixer -q set "Aux2" 70% unmute &> /dev/null
/usr/bin/amixer -q set "PCM Center" 70% unmute &> /dev/null
/usr/bin/amixer -q set "PCM Front" 70% unmute &> /dev/null
/usr/bin/amixer -q set "PCM LFE" 70% unmute &> /dev/null
/usr/bin/amixer -q set "PCM Side" 70% unmute &> /dev/null
/usr/bin/amixer -q set "PCM Surround" 70% unmute &> /dev/null
/usr/bin/amixer -q set "Side" 70% unmute &> /dev/null
/usr/bin/amixer -q set 'Input Gain' 50% &> /dev/null
/usr/bin/amixer -q set FM 60% unmute &> /dev/null
alsactl store &> /dev/null
fi
#===============================================================)
# Power Managment: )
# for some notebooks is better to set the processor speed )
# to the lowest frequency )
#===============================================================)
cmdline_nofreqscaling_exist=$(cat /proc/cmdline | grep nofreqscaling)
if [ -z "$cmdline_nofreqscaling_exist" ];then
# Workaround for VIA Nehemiah
cpu_is_nehemiah=$(cat /proc/cpuinfo | grep "VIA Nehemiah" )
if [ -z "$cpu_is_nehemiah" ]; then
echo -e "\E[33;36m * \E[0m\E[01;32m Enabling on-demand CPU Power scaling \E[0m"
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed ]; then
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
fi
else
echo -e "\E[33;36m * \E[0m\E[01;32m CPU Detected is VIA Nehemiah (Power set to Performance) \E[0m"
if [ -e /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed ]; then
echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
fi
fi
else
echo -e "\E[33;36m * \E[0m\E[01;32m CPU Power scaling disabled \E[0m"
fi
#===============================================================)
# PASSWORD HANDLING: )
# Here I decide how use the passwords )
#===============================================================)
cmdline_autoscramble_exist=$(cat /proc/cmdline | grep autoscramble)
if [ -n "$cmdline_autoscramble_exist" ]; then
echo
echo -e "\E[33;36m * \E[0m\E[01;36m Autoscrambling root passwords for S E C U R I T Y"
echo root:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1
echo sabayonuser:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1
else
echo
echo -e "\t *\E[01;32m root password\E[0m : \E[01;33m root \E[0m"
echo -e "\t *\E[01;32m username\E[0m : \E[01;33m sabayonuser\E[0m |\E[01;32m password\E[0m : \E[01;33m sabayonuser\E[0m"
fi
cmdline_session_exist=$(cat /proc/cmdline | grep session=)
if [ -n "$cmdline_session_exist" ]; then
# Session exists, should be: kde,gnome,fluxbox
for word in `cat /proc/cmdline` ; do
case $word in
session=kde)
# change default DE to KDE
echo "[Desktop]" > /home/sabayonuser/.dmrc
echo "Session=kde-3.5" >> /home/sabayonuser/.dmrc
chown sabayonuser /home/sabayonuser/.dmrc
#AutoLoginEnable=true
sed -i 's/AutoLoginEnable=false/AutoLoginEnable=true/' /usr/kde/3.5/share/config/kdm/kdmrc
#AutoLoginUser=sabayonuser
sed -i 's/AutoLoginUser=.*/AutoLoginUser=sabayonuser/' /usr/kde/3.5/share/config/kdm/kdmrc
;;
session=gnome)
# change default DE to GNOME
echo "[Desktop]" > /home/sabayonuser/.dmrc
echo "Session=gnome" >> /home/sabayonuser/.dmrc
chown sabayonuser /home/sabayonuser/.dmrc
#AutoLoginEnable=true
sed -i 's/AutoLoginEnable=false/AutoLoginEnable=true/' /usr/kde/3.5/share/config/kdm/kdmrc
#AutoLoginUser=sabayonuser
sed -i 's/AutoLoginUser=.*/AutoLoginUser=sabayonuser/' /usr/kde/3.5/share/config/kdm/kdmrc
;;
session=metisse-kde)
# change default DE to Metisse on KDE
echo "[Desktop]" > /home/sabayonuser/.dmrc
echo "Session=metisse-kde" >> /home/sabayonuser/.dmrc
chown sabayonuser /home/sabayonuser/.dmrc
#AutoLoginEnable=true
sed -i 's/AutoLoginEnable=false/AutoLoginEnable=true/' /usr/kde/3.5/share/config/kdm/kdmrc
#AutoLoginUser=sabayonuser
sed -i 's/AutoLoginUser=.*/AutoLoginUser=sabayonuser/' /usr/kde/3.5/share/config/kdm/kdmrc
;;
session=metisse-gnome)
# change default DE to Metisse on GNOME
echo "[Desktop]" > /home/sabayonuser/.dmrc
echo "Session=metisse-gnome" >> /home/sabayonuser/.dmrc
chown sabayonuser /home/sabayonuser/.dmrc
#AutoLoginEnable=true
sed -i 's/AutoLoginEnable=false/AutoLoginEnable=true/' /usr/kde/3.5/share/config/kdm/kdmrc
#AutoLoginUser=sabayonuser
sed -i 's/AutoLoginUser=.*/AutoLoginUser=sabayonuser/' /usr/kde/3.5/share/config/kdm/kdmrc
;;
session=fluxbox)
# change default DE to Fluxbox
echo "[Desktop]" > /home/sabayonuser/.dmrc
echo "Session=fluxbox" >> /home/sabayonuser/.dmrc
chown sabayonuser /home/sabayonuser/.dmrc
#AutoLoginEnable=true
sed -i 's/AutoLoginEnable=false/AutoLoginEnable=true/' /usr/kde/3.5/share/config/kdm/kdmrc
#AutoLoginUser=sabayonuser
sed -i 's/AutoLoginUser=.*/AutoLoginUser=sabayonuser/' /usr/kde/3.5/share/config/kdm/kdmrc
;;
esac
done
fi
# XsistenCe Mode
persistent_exists=$(cat /proc/cmdline | grep "xsistence")
if [ -n "$persistent_exists" ]; then
xsistence_mb=$(cat /proc/cmdline | grep "xsistence_mb=")
if [ -n "$xsistence_mb" ];then
for word in `cat /proc/cmdline` ; do
case $word in
xsistence_mb=*)
xsistence_img_mb=$(echo $word | cut -d "=" -f 2)
;;
esac
done
else
xsistence_img_mb=28
fi
xsistence_found="0"
# Persistent Mode enabled
echo -e "\E[33;36m * \E[0m \E[01;32m Enabling XsistenCe Mode (logfile: /tmp/xsistence.log)... \E[0m"
echo -en "\E[33;36m * \E[0m \E[01;32m Please plug-in your USB Memory Stick now (10 seconds)... \E[0m"
sleep 10
echo -en "Waiting for devices..."
sleep 6
echo -e "Scanning."
sleep 1
for file in /sys/block/*/device; do
is_floppy=$(echo $file | grep "fd[0-99]")
is_sr=$(echo $file | grep "sr[0-99]")
if [ -z "$is_floppy" ] || [ -z "$is_sr" ]; then
# if it's not a floppy or an external recorder, scrub it
device=$(echo $file | cut -d/ -f4)
if [ -e /sys/block/$device/removable ]; then
is_removable=$(cat /sys/block/$device/removable)
else
is_removable="0"
fi
if [ "$is_removable" = "1" ]; then
# I have found a removable drive, seek it !
# Counting partitions...
partitions_list=$(ls /dev/$device*)
for word in $partitions_list; do
if [ "$xsistence_found" = "0" ]; then
# Mount them and verify the correct operation
mkdir /mnt/xsistence &> /dev/null
mount $word /mnt/xsistence &> /dev/null
if [ "$?" = "0" ]; then
if [ ! -e /tmp/xsistence.log ]; then
echo "Mounted "$word "for test" > /tmp/xsistence.log
else
echo "Mounted "$word "for test" >> /tmp/xsistence.log
fi
# Look for "xsistence-mode" file (case insensitive)
file_found=$(find /mnt/xsistence -maxdepth 1 -nowarn -iname xsistence-mode)
if [ -n "$file_found" ]; then
# test r/w capabilities
touch /mnt/xsistence/.touch-test &> /dev/null
if [ "$?" = "0" ] && [ -e /mnt/xsistence/.touch-test ]; then
rm /mnt/xsistence/.touch-test
# Look for existing image
if [ -e /mnt/xsistence/sabayon-xsistence.ext3 ]; then
if [ ! -e /tmp/xsistence.log ]; then
echo "/mnt/xsistence/sabayon-xsistence.ext3 on "$word "exists" > /tmp/xsistence.log
else
echo "/mnt/xsistence/sabayon-xsistence.ext3 on "$word "exists" >> /tmp/xsistence.log
fi
# found ! mount it
mount -o loop /mnt/xsistence/sabayon-xsistence.ext3 /home &> /dev/null
if [ "$?" = "0" ]; then
if [ ! -e /tmp/xsistence.log ]; then
echo "/mnt/xsistence/sabayon-xsistence.ext3 mounted using "$word > /tmp/xsistence.log
else
echo "/mnt/xsistence/sabayon-xsistence.ext3 mounted using "$word >> /tmp/xsistence.log
fi
xsistence_found="1"
# print the output
echo -e "\t \t Found XsistenCe on "$word". Mounted and fully working."
else
if [ ! -e /tmp/xsistence.log ]; then
echo "/mnt/xsistence/sabayon-xsistence.ext3 cannot be mounted using " $word > /tmp/xsistence.log
else
echo "/mnt/xsistence/sabayon-xsistence.ext3 cannot be mounted using " $word >> /tmp/xsistence.log
fi
umount /mnt/xsistence -f &> /dev/null
rmdir /mnt/xsistence /&> /dev/null
# print the output
echo -e "\t \t Found XsistenCe on "$word". But the image does not work."
fi
else
if [ ! -e /tmp/xsistence.log ]; then
echo "/mnt/xsistence/sabayon-xsistence.ext3 on "$word "does not exist" > /tmp/xsistence.log
else
echo "/mnt/xsistence/sabayon-xsistence.ext3 on "$word "does not exist" >> /tmp/xsistence.log
fi
# create disk image and test available space
# need to find another way to get avaiable space
# output
echo -en "\t \t Trying to create the image on "$word"..."
dd if=/dev/zero of=/mnt/xsistence/sabayon-xsistence.ext3 count=$xsistence_img_mb bs=1024000 &> /dev/null
if [ "$?" = "0" ]; then
losetup /dev/loop7 /mnt/xsistence/sabayon-xsistence.ext3
loopdevice="7"
if [ "$?" != "0" ]; then
# trying another loopback device
losetup /dev/loop6 /mnt/xsistence/sabayon-xsistence.ext3
loopdevice="6"
fi
if [ "$?" != "0" ]; then
# trying another loopback device
losetup /dev/loop5 /mnt/xsistence/sabayon-xsistence.ext3
loopdevice="5"
fi
if [ "$?" != "0" ]; then
# trying another loopback device
losetup /dev/loop4 /mnt/xsistence/sabayon-xsistence.ext3
loopdevice="4"
fi
if [ "$?" != "0" ]; then
# trying another loopback device
losetup /dev/loop3 /mnt/xsistence/sabayon-xsistence.ext3
loopdevice="3"
fi
if [ "$?" != "0" ]; then
# trying another loopback device
losetup /dev/loop2 /mnt/xsistence/sabayon-xsistence.ext3
loopdevice="2"
fi
if [ "$?" = "0" ]; then
# loopback ok, formatting...
mkfs.ext3 /dev/loop$loopdevice &> /dev/null
if [ "$?" = "0" ]; then
if [ ! -e /tmp/xsistence.log ]; then
echo "Image formatted and ready to get filled " $word "using loopback" $loopdevice > /tmp/xsistence.log
else
echo "Image formatted and ready to get filled " $word "using loopback" $loopdevice >> /tmp/xsistence.log
fi
mkdir /mnt/loopbacktemp
mount -o loop /mnt/xsistence/sabayon-xsistence.ext3 /mnt/loopbacktemp
if [ "$?" = "0" ]; then
if [ ! -e /tmp/xsistence.log ]; then
echo "Image formatted and ready to get filled " $word "using loopback" $loopdevice > /tmp/xsistence.log
else
echo "Image formatted and ready to get filled " $word "using loopback" $loopdevice >> /tmp/xsistence.log
fi
cp -Rp /home/* /mnt/loopbacktemp/
mount --move /mnt/loopbacktemp/ /home/
if [ "$?" = "0" ]; then
echo -e "image created and mounted !"
xsistence_found="1"
if [ ! -e /tmp/xsistence.log ]; then
echo "Image created and mounted using" $word "and loopback" $loopdevice > /tmp/xsistence.log
else
echo "Image created and mounted using" $word "and loopback" $loopdevice >> /tmp/xsistence.log
fi
else
echo -e "Sorry, cannot move mount point"
if [ ! -e /tmp/xsistence.log ]; then
echo "Cannot move mount point for" $word "and loopback" $loopdevice > /tmp/xsistence.log
else
echo "Cannot move mount point for" $word "and loopback" $loopdevice >> /tmp/xsistence.log
fi
fi
else
echo -e "Sorry, cannot mount the image"
if [ ! -e /tmp/xsistence.log ]; then
echo "Image not mounted" $word "using loopback" $loopdevice > /tmp/xsistence.log
else
echo "Image not mounted" $word "using loopback" $loopdevice >> /tmp/xsistence.log
fi
fi
else
echo -e "Sorry, cannot format the image"
if [ ! -e /tmp/xsistence.log ]; then
echo "Cannot format the image on " $word > /tmp/xsistence.log
else
echo "Cannot format the image on " $word >> /tmp/xsistence.log
fi
fi
else
echo -e "Sorry, no free loopback device"
if [ ! -e /tmp/xsistence.log ]; then
echo "No free loopback device for " $word > /tmp/xsistence.log
else
echo "No free loopback device for " $word >> /tmp/xsistence.log
fi
fi
else
echo -e "Sorry, " $xsistence_img_mb " MB required"
rm -rf /mnt/xsistence/sabayon-xsistence.ext3 &> /dev/null
fi
fi
else
if [ ! -e /tmp/xsistence.log ]; then
echo "No read-write capabilities for " $word > /tmp/xsistence.log
else
echo "No read-write capabilities for " $word >> /tmp/xsistence.log
fi
umount /mnt/xsistence -f &> /dev/null
rmdir /mnt/xsistence /&> /dev/null
fi
else
if [ ! -e /tmp/xsistence.log ]; then
echo "xsistence-mode not found on " $word > /tmp/xsistence.log
else
echo "xsistence-mode not found on " $word >> /tmp/xsistence.log
fi
umount /mnt/xsistence -f &> /dev/null
rmdir /mnt/xsistence /&> /dev/null
fi
else
if [ ! -e /tmp/xsistence.log ]; then
echo "Tried to mount " $word "without luck" > /tmp/xsistence.log
else
echo "Tried to mount " $word "without luck" >> /tmp/xsistence.log
fi
fi
fi
done
# if not create it
# mount it
# bind the files
echo
fi
fi
done
if [ "$xsistence_found" = "0" ]; then
echo -e "\t \t No XsistenCe ready devices found"
fi
else
# Persistent Mode disabled
echo -e "\E[33;36m * \E[0m \E[01;32m XsistenCe is not enabled. \E[0m"
fi
# Create /media for removable devices
if [ ! -e /media ]; then
mkdir /media
chmod 755 /media
fi
# Check if KEYMAP is forced by cmdline
cmdline_keymap_exist=$(cat /proc/cmdline | grep -i "KEYMAP=")
cmdline_keymap_isolinux_exist=$(cat /proc/cmdline | grep -i "console-setup/layoutcode=")
if [ -n "$cmdline_keymap_isolinux_exist" ]; then
cmdline_keymap_exist="console-setup"
fi
if [ -n "$cmdline_keymap_exist" ];then
if [ "$cmdline_keymap_exist" == "console-setup" ]; then
# detect keymap
for word in `cat /proc/cmdline` ; do
case $word in
console-setup/layoutcode=*)
keymap_toset=$(echo $word | cut -d "=" -f 2)
;;
esac
done
else
# detect keymap
for word in `cat /proc/cmdline` ; do
case $word in
KEYMAP=*)
keymap_toset=$(echo $word | cut -d "=" -f 2)
;;
keymap=*)
keymap_toset=$(echo $word | cut -d "=" -f 2)
;;
esac
done
fi
if [ -n "$keymap_toset" ]; then
/sbin/keyboard-setup $keymap_toset &> /dev/null
fi
fi
# Setup SAMBA Hostname
smbhostname="sabayonlinux-"$RANDOM
execute_cmd="sed -i \"s/netbios name = .*/netbios name = $smbhostname/\" /etc/samba/smb.conf"
echo $execute_cmd | /bin/bash
/etc/init.d/samba restart --nodeps &> /dev/null
tor_exists=$(cat /proc/cmdline | grep " tor")
if [ -n "$tor_exists" ]; then
echo -en "\E[33;36m * \E[0m \E[01;32m Starting Safe Browsing extensions...\E[0m"
/sbin/safe-browsing-setup enable &> /dev/null
echo -e Done
fi
cmdline_mediacenter_exists=$(cat /proc/cmdline | grep mediacenter)
if [ -n "$cmdline_mediacenter_exists" ]; then
# Start Elisa
echo -en "\E[33;36m * \E[0m \E[01;32m Starting Media Center...\E[0m"
# change default wm to fluxbox
echo "[Desktop]" > /home/sabayonuser/.dmrc
echo "Session=fluxbox" >> /home/sabayonuser/.dmrc
chown sabayonuser /home/sabayonuser/.dmrc
# Set KDM Autologin and scramble root/sabayonuser passwords
#AutoLoginEnable=true
sed -i 's/AutoLoginEnable=.*/AutoLoginEnable=true/' /usr/kde/3.5/share/config/kdm/kdmrc
#AutoLoginUser=sabayonuser
sed -i 's/AutoLoginUser=.*/AutoLoginUser=sabayonuser/' /usr/kde/3.5/share/config/kdm/kdmrc
sed -i 's/AutoLoginDelay=.*/AutoLoginDelay=0/' /usr/kde/3.5/share/config/kdm/kdmrc
# Change passwords for security
echo root:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1
echo sabayonuser:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1
# Set Elisa to Fluxbox startup
echo >> /home/sabayonuser/.fluxbox/init
echo "session.screen0.rootCommand: fbsetbg -l & elisa && sudo halt" >> /home/sabayonuser/.fluxbox/init
echo -e "\E[01;32mDone \E[0m"
fi
# Mount games squashfs if exists
if [ -e "/mnt/cdrom/games.squashfs" ]; then
mkdir -p /install-data/games-ro &> /dev/null
mount -o loop /mnt/cdrom/games.squashfs /install-data/games-ro &> /dev/null
mkdir -p /install-data/games-changes &> /dev/null
mount -t tmpfs none /install-data/games-changes &> /dev/null
mount -t aufs -o br=/install-data/games-changes:/install-data/games-ro none /install-data/games
# copy warsow
cp /usr/share/applications/warsow-warsow.desktop /home/sabayonuser/Desktop/ &> /dev/null
# copy sauerbraten
cp /usr/share/applications/sauerbraten_client-bin-sauerbraten.desktop /home/sabayonuser/Desktop/ &> /dev/null
# copy dangerdeep
cp /usr/share/applications/dangerdeep-dangerdeep.desktop /home/sabayonuser/Desktop/ &> /dev/null
# copy torcs
cp /usr/share/applications/torcs-torcs.desktop /home/sabayonuser/Desktop/ &> /dev/null
# copy nexuiz
cp /usr/share/applications/nexuiz-glx-nexuiz.desktop /home/sabayonuser/Desktop/ &> /dev/null
# copy savage
cp /usr/share/applications/savage-savage-bin.desktop /home/sabayonuser/Desktop/ &> /dev/null
# copy flightgear
cp /usr/share/applications/fgfs-flightgear.desktop /home/sabayonuser/Desktop/ &> /dev/null
# copy secondlife
cp /usr/share/applications/secondlife-bin-secondlife-bin.desktop /home/sabayonuser/Desktop &> /dev/null
chown sabayonuser /home/sabayonuser/Desktop/*.desktop
cmdline_warsow_exists=$(cat /proc/cmdline | grep sabayon-game=warsow)
if [ -n "$cmdline_warsow_exists" ]; then
# Start Coldwar
echo -en "\E[33;36m * \E[0m \E[01;32m Starting Warsow...\E[0m"
prepare_fluxbox_locked_autologin
# Set Freevo to Fluxbox startup
echo >> /home/sabayonuser/.fluxbox/init
echo "session.screen0.rootCommand: fbsetbg -l & /scripts/rungame.sh /usr/games/bin/warsow && sudo halt -fp" >> /home/sabayonuser/.fluxbox/init
echo -e "\E[01;32mDone \E[0m"
fi
cmdline_sauerbraten_exists=$(cat /proc/cmdline | grep sabayon-game=sauerbraten)
if [ -n "$cmdline_sauerbraten_exists" ]; then
# Start Coldwar
echo -en "\E[33;36m * \E[0m \E[01;32m Starting Sauerbraten...\E[0m"
prepare_fluxbox_locked_autologin
# Set Freevo to Fluxbox startup
echo >> /home/sabayonuser/.fluxbox/init
echo "session.screen0.rootCommand: fbsetbg -l & /scripts/rungame.sh /usr/games/bin/sauerbraten_client-bin && sudo halt -fp" >> /home/sabayonuser/.fluxbox/init
echo -e "\E[01;32mDone \E[0m"
fi
cmdline_dangerdeep_exists=$(cat /proc/cmdline | grep sabayon-game=dangerdeep)
if [ -n "$cmdline_dangerdeep_exists" ]; then
# Start Coldwar
echo -en "\E[33;36m * \E[0m \E[01;32m Starting Dangerdeep...\E[0m"
prepare_fluxbox_locked_autologin
# Set Freevo to Fluxbox startup
echo >> /home/sabayonuser/.fluxbox/init
echo "session.screen0.rootCommand: fbsetbg -l & /scripts/rungame.sh /usr/games/bin/dangerdeep && sudo halt -fp" >> /home/sabayonuser/.fluxbox/init
echo -e "\E[01;32mDone \E[0m"
fi
cmdline_torcs_exists=$(cat /proc/cmdline | grep sabayon-game=torcs)
if [ -n "$cmdline_torcs_exists" ]; then
# Start Coldwar
echo -en "\E[33;36m * \E[0m \E[01;32m Starting Torcs...\E[0m"
prepare_fluxbox_locked_autologin
# Set Freevo to Fluxbox startup
echo >> /home/sabayonuser/.fluxbox/init
echo "session.screen0.rootCommand: fbsetbg -l & /scripts/rungame.sh /usr/games/bin/torcs && sudo halt -fp" >> /home/sabayonuser/.fluxbox/init
echo -e "\E[01;32mDone \E[0m"
fi
cmdline_nexuiz_exists=$(cat /proc/cmdline | grep sabayon-game=nexuiz)
if [ -n "$cmdline_nexuiz_exists" ]; then
# Start Coldwar
echo -en "\E[33;36m * \E[0m \E[01;32m Starting Nexuiz...\E[0m"
prepare_fluxbox_locked_autologin
# Set Freevo to Fluxbox startup
echo >> /home/sabayonuser/.fluxbox/init
echo "session.screen0.rootCommand: fbsetbg -l & /scripts/rungame.sh /usr/games/bin/nexuiz && sudo halt -fp" >> /home/sabayonuser/.fluxbox/init
echo -e "\E[01;32mDone \E[0m"
fi
cmdline_savage_exists=$(cat /proc/cmdline | grep sabayon-game=savage)
if [ -n "$cmdline_savage_exists" ]; then
# Start Coldwar
echo -en "\E[33;36m * \E[0m \E[01;32m Starting Savage...\E[0m"
prepare_fluxbox_locked_autologin
# Set Freevo to Fluxbox startup
echo >> /home/sabayonuser/.fluxbox/init
echo "session.screen0.rootCommand: fbsetbg -l & /scripts/rungame.sh /usr/games/bin/savage && sudo halt -fp" >> /home/sabayonuser/.fluxbox/init
echo -e "\E[01;32mDone \E[0m"
fi
cmdline_flightgear_exists=$(cat /proc/cmdline | grep sabayon-game=flightgear)
if [ -n "$cmdline_flightgear_exists" ]; then
# Start Coldwar
echo -en "\E[33;36m * \E[0m \E[01;32m Starting FlightGear...\E[0m"
prepare_fluxbox_locked_autologin
# Set Freevo to Fluxbox startup
echo >> /home/sabayonuser/.fluxbox/init
echo "session.screen0.rootCommand: fbsetbg -l & /scripts/rungame.sh /usr/games/bin/fgfs && sudo halt -fp" >> /home/sabayonuser/.fluxbox/init
echo -e "\E[01;32mDone \E[0m"
fi
cmdline_secondlife_exists=$(cat /proc/cmdline | grep sabayon-game=secondlife)
if [ -n "$cmdline_secondlife_exists" ]; then
# Start Coldwar
echo -en "\E[33;36m * \E[0m \E[01;32m Starting Second Life...\E[0m"
prepare_fluxbox_locked_autologin
# Set Freevo to Fluxbox startup
echo >> /home/sabayonuser/.fluxbox/init
echo "session.screen0.rootCommand: fbsetbg -l & /scripts/rungame.sh /usr/games/bin/secondlife-bin && sudo halt -fp" >> /home/sabayonuser/.fluxbox/init
echo -e "\E[01;32mDone \E[0m"
fi
fi
# At this point
echo -en "\E[33;36m * \E[0m \E[01;32m Waiting for OpenGL Configurator to finish... \E[0m"
while [ -e "/etc/x-setup-configuration-running" ]
do
# waiting...
sleep 1
done
echo -e "Done"
# Strict HARDWARE detection and configuration
pc_is_macbook=$(lshal | grep -i macbook)
if [ -n "$pc_is_macbook" ]; then
# launch pommed
if [ -e "/etc/init.d/pommed" ]; then
/etc/init.d/pommed start &> /dev/null
rc-update add pommed default &> /dev/null
fi
fi
# MOVED HERE TO AVOID RACE CONDITIONS ON WRITING /etc/profile.env variables
# Check if LANG is forced by cmdline
cmdline_lang_exist=$(cat /proc/cmdline | grep -i "lang=")
cmdline_locale_exist=$(cat /proc/cmdline | grep -i "locale=")
if [ -n "$cmdline_locale_exist" ]; then
cmdline_lang_exist="locale-setup"
fi
if [ -n "$cmdline_lang_exist" ];then
if [ "$cmdline_lang_exist" == "locale-setup" ]; then
# detect keymap
for word in `cat /proc/cmdline` ; do
case $word in
locale=*)
lang_toset=$(echo $word | cut -d "=" -f 2)
;;
esac
done
else
for word in `cat /proc/cmdline` ; do
case $word in
LANG=*)
lang_toset=$(echo $word | cut -d "=" -f 2)
;;
lang=*)
lang_toset=$(echo $word | cut -d "=" -f 2)
;;
esac
done
fi
# Setup Language
/sbin/language-setup $lang_toset &> /dev/null
fi
# Start Accel Manager or Configure XGL/AIGLX
start_acceleration_manager
}
stop() {
persistent_exists=$(cat /proc/cmdline | grep "xsistence")
if [ -n "$persistent_exists" ]; then
sleep 5
sync
# umount every possible mounted filesystem (/home and /mnt/xsistence)
mnt_xsistence_img_mounted=$(cat /etc/mtab | grep "/mnt/xsistence/sabayon-xsistence.ext3")
if [ -n "$mnt_xsistence_img_mounted" ]; then
mozilla_cache=$(find /home/*/.mozilla -nowarn -name Cache)
for word in $mozilla_cache; do
rm -rf $word
done
sync
sleep 1
umount -l -r -d /mnt/xsistence/sabayon-xsistence.ext3
fi
mnt_xsistence_mounted=$(cat /etc/mtab | grep "/mnt/xsistence")
if [ -n "$mnt_xsistence_mounted" ]; then
umount -l -r /mnt/xsistence
fi
# redundant...
home_mounted=$(cat /etc/mtab | grep "/home ")
if [ -n "$home_mounted" ]; then
umount -l -r -d /home
fi
fi
}
@@ -0,0 +1,303 @@
#!/bin/bash
configure_opengl() {
if [ -n "$cmdline_opengl_exists" ]; then
for word in `cat /proc/cmdline` ; do
case $word in
opengl=*)
opengl_toset=$(echo $word | cut -d "=" -f 2)
nice -20 opengl-activator $opengl_toset
;;
esac
done
else
get_video_cards &> /dev/null
get_current_gl=$(opengl-activator show)
if [ "$get_current_gl" != "$GLTYPE" ]; then
if [ -z "$cmdline_noproprietary_exist" ]; then
source /etc/profile
nice -20 opengl-activator $GLTYPE
source /etc/profile
else
if [ -z "$cmdline_cdroot_exist" ]; then
source /etc/profile
nice -20 opengl-activator xorg-x11
source /etc/profile
fi
fi
fi
fi
}
runtime_linking_proprietary_drivers() {
current_arch=$(uname -m)
if [ "$current_arch" == "x86_64" ]; then
ld_arch="elf_x86_64"
elif [ "$current_arch" == "i686" ]; then
ld_arch="elf_i386"
fi
lspci_vga=$(lspci | grep ' VGA ')
mount -t tmpfs none /lib/modules/$(uname -r)/video
if [ -n "`echo $lspci_vga | grep -i nvidia`" ]; then
ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
elif [ -n "`echo $lspci_vga | grep -i ati`" ]; then
ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/fglrx.ko /lib/fglrx/fglrx.o /lib/fglrx/fglrx.mod.o
elif [ -n "`echo $lspci_vga | grep -i unknown`" ]; then
ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/fglrx.ko /lib/fglrx/fglrx.o /lib/fglrx/fglrx.mod.o
elif [ -z "$lspci_vga" ]; then
ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/fglrx.ko /lib/fglrx/fglrx.o /lib/fglrx/fglrx.mod.o
fi
}
configure_video_settings() {
# X.Org must be started and now I'm checking if user wants to start the server at 640x480
if [ -n "$cmdline_legacy_exist" ]; then
mv -f /etc/X11/xorg.conf.legacy /etc/X11/xorg.conf
/sbin/gpu-configuration &> /dev/null
#echo -e "\E[33;36m * \E[0m \E[01;32m Starting up X.Org in (- Legacy -) mode ::\E[0m"
#echo -e "\t Display Configuration: 800x600 at 60Hz"
else
# Probe for Hsync, Vsync, Modes and in case the user has specified
# something else on the command line, it will be overwritten
if [ -e "/usr/sbin/ddcxinfo-knoppix" ] && [ -z "$cmdline_noddc_exist" ] && [ -n "$cmdline_cdroot_exist" ]; then
# hsync
hsync=$(/usr/sbin/ddcxinfo-knoppix -hsync)
if [ "$hsync" != "0-0" ]; then
# ok, we got it
sed -i '/HorizSync/ s/#//' /etc/X11/xorg.conf
sed -i '/HorizSync/ s/.*/ HorizSync '$hsync'/' /etc/X11/xorg.conf
fi
# vsync
vsync=$(/usr/sbin/ddcxinfo-knoppix -vsync)
if [ "$vsync" != "0-0" ]; then
# ok, we got it
sed -i '/VertRefresh/ s/#//' /etc/X11/xorg.conf
sed -i '/VertRefresh/ s/.*/ VertRefresh '$vsync'/' /etc/X11/xorg.conf
fi
# Modes?
if [ "$vsync" != "0-0" ] && [ "$hsync" != "0-0" ]; then
modes=$(/usr/sbin/ddcxinfo-knoppix -modes)
if [ -n "$modes" ]; then
sed -i '/Modes/ s/#//' /etc/X11/xorg.conf
sed -i "/Modes/ s/.*/ $modes/" /etc/X11/xorg.conf
fi
fi
fi
if [ -n "$cmdline_resolution_forced" ];then
# change resolution in X.Org
for word in `cat /proc/cmdline` ; do
case $word in
res=*)
resolution_toset=$(echo $word | cut -d "=" -f 2)
if [ "$resolution_toset" == "800x600" ]; then
sed -i '/Modes.*".*"/ s/"1024x768"/"'$resolution_toset'"/' /etc/X11/xorg.conf
elif [ "$resolution_toset" == "640x480" ]; then
sed -i '/Modes.*".*"/ s/"1024x768"/"'$resolution_toset'"/' /etc/X11/xorg.conf
else
sed -i '/Modes.*".*"/ s/.*/ Modes "'$resolution_toset'" "1024x768" "800x600"/' /etc/X11/xorg.conf
fi
#echo -e "\E[33;36m * \E[0m\E[01;32m Setting X.Org to $resolution_toset if it's available \E[0m"
sed -i '/Modes/ s/#//' /etc/X11/xorg.conf
;;
esac
done
fi
# Check if refresh= is forced by cmdline
if [ -n "$cmdline_refresh_exist" ];then
# change VertRefresh in X.Org
for word in `cat /proc/cmdline` ; do
case $word in
refresh=*)
sed -i '/VertRefresh/ s/#//' /etc/X11/xorg.conf
refresh_toset=$(echo $word | cut -d "=" -f 2)
sed -i '/VertRefresh/ s/.*/ VertRefresh '$refresh_toset'/' /etc/X11/xorg.conf
#echo -e "\E[33;36m * \E[0m\E[01;32m Setting VertRefresh to $refresh_toset Hz \E[0m"
;;
esac
done
fi
# Check if refresh= is forced by cmdline
if [ -n "$cmdline_hsync_exist" ];then
# change HorizSync in X.Org
for word in `cat /proc/cmdline` ; do
case $word in
hsync=*)
sed -i '/HorizSync/ s/#//' /etc/X11/xorg.conf
hsync_toset=$(echo $word | cut -d "=" -f 2)
sed -i '/HorizSync/ s/.*/ HorizSync '$hsync_toset'/' /etc/X11/xorg.conf
#echo -e "\E[33;36m * \E[0m\E[01;32m Setting HorizSync to $hsync_toset Hz \E[0m"
;;
esac
done
fi
if [ -z "$cmdline_onlyvesa_exist" ]; then
#echo -e "\E[33;36m * \E[0m\E[01;32m Video Card:`lspci | grep VGA | cut -d: -f3` \E[0m"
/sbin/gpu-configuration &> /dev/null
fi
fi
}
configure_input_devices() {
# Detect ALPS Touchpad
#Option "MaxSpeed" "0.7"
#Option "MinSpeed" "0.18"
#Option "AccelFactor" "0.08"
#Option "TopEdge" "120"
#Option "LeftEdge" "120"
#Option "BottomEdge" "830"
#Option "RightEdge" "650"
#Option "FingerLow" "25"
#Option "FingerHigh" "30"
if [ -e "/proc/bus/input/devices" ]; then
# Enable Synaptic/ALPS touchpad
if [ -n "$alps_touchpad_exist" ] || [ -n "$synaptics_touchpad_exist" ]; then
sed -i '/InputDevice.*Synaptics1/ s/#//' /etc/X11/xorg.conf
fi
if [ -n "$alps_touchpad_exist" ]; then
sed -i '/MaxSpeed/ s/#//' /etc/X11/xorg.conf
sed -i '/MinSpeed/ s/#//' /etc/X11/xorg.conf
sed -i '/AccelFactor/ s/#//' /etc/X11/xorg.conf
sed -i '/TopEdge/ s/#//' /etc/X11/xorg.conf
sed -i '/LeftEdge/ s/#//' /etc/X11/xorg.conf
sed -i '/BottomEdge/ s/#//' /etc/X11/xorg.conf
sed -i '/RightEdge/ s/#//' /etc/X11/xorg.conf
sed -i '/FingerLow/ s/#//' /etc/X11/xorg.conf
sed -i '/FingerHigh/ s/#//' /etc/X11/xorg.conf
fi
# Configure touchpad for MacBook
if [ -n "$is_macbook" ]; then
sed -i '/MaxSpeed/ s/#//' /etc/X11/xorg.conf
sed -i '/MinSpeed/ s/#//' /etc/X11/xorg.conf
sed -i '/AccelFactor/ s/#//' /etc/X11/xorg.conf
sed -i '/TopEdge/ s/#//' /etc/X11/xorg.conf
sed -i '/LeftEdge/ s/#//' /etc/X11/xorg.conf
sed -i '/BottomEdge/ s/#//' /etc/X11/xorg.conf
sed -i '/RightEdge/ s/#//' /etc/X11/xorg.conf
sed -i '/FingerLow/ s/#//' /etc/X11/xorg.conf
sed -i '/FingerHigh/ s/#//' /etc/X11/xorg.conf
sed -i '/MaxTapTime/ s/#//' /etc/X11/xorg.conf
sed -i '/MaxTapMove/ s/#//' /etc/X11/xorg.conf
sed -i '/MaxDoubleTapTime/ s/#//' /etc/X11/xorg.conf
sed -i '/VertScrollDelta/ s/#//' /etc/X11/xorg.conf
sed -i '/HorizScrollDelta/ s/#//' /etc/X11/xorg.conf
sed -i '/TapButton2/ s/#//' /etc/X11/xorg.conf
sed -i '/TapButton3/ s/#//' /etc/X11/xorg.conf
sed -i '/VertTwoFingerScroll/ s/#//' /etc/X11/xorg.conf
# now change values
sed -i '/LeftEdge/ s/"LeftEdge".*".*"/"LeftEdge"\t\t"100"/' /etc/X11/xorg.conf
sed -i '/RightEdge/ s/"RightEdge".*".*"/"RightEdge"\t\t"1120"/' /etc/X11/xorg.conf
sed -i '/TopEdge/ s/"TopEdge".*".*"/"TopEdge"\t\t"50"/' /etc/X11/xorg.conf
sed -i '/BottomEdge/ s/"BottomEdge".*".*"/"BottomEdge"\t\t"310"/' /etc/X11/xorg.conf
sed -i '/FingerLow/ s/"FingerLow".*".*"/"FingerLow"\t\t"25"/' /etc/X11/xorg.conf
sed -i '/FingerHigh/ s/"FingerHigh".*".*"/"FingerHigh"\t\t"30"/' /etc/X11/xorg.conf
sed -i '/MaxTapTime/ s/"MaxTapTime".*".*"/"MaxTapTime"\t\t"180"/' /etc/X11/xorg.conf
sed -i '/MaxTapMove/ s/"MaxTapMove".*".*"/"MaxTapMove"\t\t"220"/' /etc/X11/xorg.conf
sed -i '/MaxDoubleTapTime/ s/"MaxDoubleTapTime".*".*"/"MaxDoubleTapTime"\t\t"180"/' /etc/X11/xorg.conf
sed -i '/VertScrollDelta/ s/"VertScrollDelta".*".*"/"VertScrollDelta"\t\t"20"/' /etc/X11/xorg.conf
sed -i '/HorizScrollDelta/ s/"HorizScrollDelta".*".*"/"HorizScrollDelta"\t\t"50"/' /etc/X11/xorg.conf
sed -i '/MinSpeed/ s/"MinSpeed".*".*"/"MinSpeed"\t\t"0.79"/' /etc/X11/xorg.conf
sed -i '/MaxSpeed/ s/"MaxSpeed".*".*"/"MaxSpeed"\t\t"0.88"/' /etc/X11/xorg.conf
sed -i '/AccelFactor/ s/"AccelFactor".*".*"/"AccelFactor"\t\t"0.0015"/' /etc/X11/xorg.conf
fi
else
echo "warning: /proc/bus/input/devices does not exist, cannot detect ALPS TouchPads"
fi
# Detect Wacom Devices
if [ -n "`cat /proc/bus/input/devices | grep Wacom`" ]; then
# #InputDevice "wacom1" "SendCoreEvents"
sed -i '/InputDevice.*wacom1/ s/#//' /etc/X11/xorg.conf
sed -i '/InputDevice.*wacom2/ s/#//' /etc/X11/xorg.conf
sed -i '/InputDevice.*wacom3/ s/#//' /etc/X11/xorg.conf
fi
# Detect Macintosh - Enabling Apple Key
if [ -n "$is_mactel" ]; then
sed -i '/XkbOptions/ s/#//' /etc/X11/xorg.conf
fi
# Detect VMware
# disable for now, since vmmouse is broken on some virtual machines
#if [ -n "$is_vmware" ]; then
# sed -i '/Driver.*mouse/ s/mouse/vmmouse/' /etc/X11/xorg.conf
#fi
}
# create seed
rm -f /etc/x-setup-configuration-running
touch /etc/x-setup-configuration-running
# get livecd functions
source /sbin/livecd-functions.sh
# Variables
cmdline_onlyvesa_exist=$(cat /proc/cmdline | grep onlyvesa)
cmdline_opengl_exists=$(cat /proc/cmdline | grep "opengl=")
cmdline_legacy_exist=$(cat /proc/cmdline | grep legacy)
cmdline_resolution_forced=$(cat /proc/cmdline | grep "res=")
cmdline_refresh_exist=$(cat /proc/cmdline | grep refresh=)
cmdline_hsync_exist=$(cat /proc/cmdline | grep hsync=)
cmdline_noddc_exist=$(cat /proc/cmdline | grep "noddc")
cmdline_cdroot_exist=$(cat /proc/cmdline | grep " cdroot")
is_mactel=$(dmidecode | grep "Vendor" | grep "Apple Computer")
is_macbook=$(dmidecode | grep "Product Name" | grep -i "MacBook")
is_vmware=$(dmidecode | grep "Product Name" | grep -i "vmware")
alps_touchpad_exist=$(cat /proc/bus/input/devices | grep -i alps)
synaptics_touchpad_exist=$(cat /proc/bus/input/devices | grep -i synaptics)
# Prepare Video Cards Proprietary Drivers
if [ -n "$cmdline_cdroot_exist" ]; then
runtime_linking_proprietary_drivers
fi
# Prepare OpenGL
if [ -z "$cmdline_onlyvesa_exist" ]; then
configure_opengl
fi
if [ -n "$cmdline_cdroot_exist" ]; then
# Configure Video Card Driver
configure_video_settings
else
/sbin/gpu-configuration &> /dev/null
fi
# Now we can configure X Input drivers
configure_input_devices
# delete seed
rm -f /etc/x-setup-configuration-running
+42
View File
@@ -0,0 +1,42 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Copyright 2006 SabayonLinux
# Distributed under the terms of the GNU General Public License v2
depend() {
before hostname
before xdm
after internetkiosk
}
start() {
is_live=$(cat /proc/cmdline | grep cdroot)
if [ -n "$is_live" ]; then
ebegin "Configuring GPU Hardware Acceleration and Input devices"
start-stop-daemon --start --background --exec /usr/sbin/x-setup-configuration --
eend 0
else
ebegin "Configuring GPU Hardware Acceleration and Input devices"
if [ -e /first_time_run ] || [ ! -e /etc/gpu-detector.conf ]; then
# store config file
lspci | grep ' VGA ' > /etc/gpu-detector.conf
eend 0
return 0
fi
lspci_vga=$(lspci | grep ' VGA ')
if [ "$lspci_vga" != "`cat /etc/gpu-detector.conf`" ]; then
if [ -e "/sbin/aiglx-setup" ]; then
/sbin/aiglx-setup disable &> /dev/null
fi
if [ -e "/sbin/xgl-setup" ]; then
/sbin/xgl-setup disable &> /dev/null
fi
/usr/sbin/x-setup-configuration &> /dev/null
lspci | grep ' VGA ' > /etc/gpu-detector.conf
fi
eend 0
fi
}
@@ -0,0 +1,159 @@
Section "Module"
Load "i2c"
Load "ddc"
Load "synaptics"
Load "vbe"
# Load "dri"
EndSection
Section "ServerFlags"
Option "AllowMouseOpenFail" "true"
EndSection
Section "InputDevice"
Identifier "Synaptics1"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
Option "SHMConfig" "on"
# For ALPS/MacBook TouchPads
#Option "MaxSpeed" "0.7"
#Option "MinSpeed" "0.18"
#Option "AccelFactor" "0.08"
#Option "TopEdge" "120"
#Option "LeftEdge" "120"
#Option "BottomEdge" "830"
#Option "RightEdge" "650"
#Option "FingerLow" "25"
#Option "FingerHigh" "30"
# MacBook touchpad
#Option "MaxTapTime" "180"
#Option "MaxTapMove" "220"
#Option "MaxDoubleTapTime" "180"
#Option "VertScrollDelta" "20"
#Option "HorizScrollDelta" "50"
#Option "TapButton2" "3"
#Option "TapButton3" "2"
#Option "VertTwoFingerScroll" "1"
# Do you keep moving the mouse while typing? Try this trick.
#synclient TouchpadOff=1 disable your synaptics touchpad
#synclient TouchpadOff=0 enable your synaptics touchpad
EndSection
Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
Option "AutoRepeat" "500 5"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
Option "XkbRules" "xorg"
# Macintosh keyboard
#Option "XkbOptions" "lv3:rwin_switch"
EndSection
# **********************************************************************
# Core Pointer's InputDevice section
# **********************************************************************
Section "InputDevice"
Identifier "Mouse1"
Driver "mouse"
Option "Device" "/dev/psaux"
EndSection
# **********************************************************************
# Monitor section
# **********************************************************************
# Any number of monitor sections may be present
Section "Monitor"
Identifier "Generic Monitor"
VertRefresh 43 - 60
HorizSync 28 - 80
EndSection
# **********************************************************************
# Graphics device section
# **********************************************************************
# Any number of graphics device sections may be present
Section "Device"
Identifier "VESA"
Driver "vesa" # do not remove vesa
#Option "RenderAccel" "on"
#Option "XAANoOffscreenPixmaps"
#Option "BusType" "PCI"
#Option "ColorTiling" "on"
#Option "EnablePageFlip" "on"
EndSection
# **********************************************************************
# Screen sections.
# **********************************************************************
Section "Screen"
# The Identifier, Device and Monitor lines must be present
Identifier "Screen 1"
Device "VESA"
Monitor "Generic Monitor"
#Option "AddARGBGLXVisuals" "true"
# The favoured Depth and/or Bpp may be specified here
DefaultDepth 24
SubSectionSub "Display"
Depth 8
ViewPort 0 0
#Modes "1024x768" "800x600" "640x480"
EndSubsection
SubSection "Display"
Depth 16
ViewPort 0 0
#Modes "1024x768" "800x600" "640x480"
EndSubsection
SubSection "Display"
Depth 24
ViewPort 0 0
#Modes "1024x768" "800x600" "640x480"
EndSubsection
EndSection
Section "ServerLayout"
# The Identifier line must be present
Identifier "Main Layout"
Screen 0 "Screen 1"
InputDevice "Mouse1" "CorePointer"
#InputDevice "Synaptics1" "SendCoreEvents"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection
Section "DRI"
Mode 0666
EndSection
Section "Extensions"
#Option "Composite" "Enable"
EndSection
@@ -1,53 +0,0 @@
# Copyright 2006 SabayonLinux
# Distributed under the terms of the GNU General Public License v2
inherit eutils
DESCRIPTION="SabayonLinux Live tools for autoconfiguration of the system"
HOMEPAGE="http://www.sabayonlinux.org"
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="amd64 x86"
IUSE="opengl professional_edition"
RDEPEND="dev-util/dialog
sys-apps/pciutils
sys-apps/gawk
!professiona_edition? ( app-admin/eselect-opengl )
!app-misc/livecd-tools
!professional_edition? ( x11-misc/desktop-acceleration-helpers )
"
DEPEND="${RDEPEND}"
src_unpack() {
cd ${WORKDIR}
cp ${FILESDIR}/${PV}/livecd-functions.sh . -p
cp ${FILESDIR}/${PV}/net-setup . -p
cp ${FILESDIR}/${PV}/x-setup-init.d . -p
cp ${FILESDIR}/${PV}/x-setup-configuration . -p
cp ${FILESDIR}/${PV}/xorg.conf . -p
cp ${FILESDIR}/${PV}/bashlogin . -p
cp ${FILESDIR}/${PV}/opengl-activator . -p
}
src_install() {
cd ${WORKDIR}
if use opengl; then
dosbin x-setup-configuration
newinitd x-setup-init.d x-setup
fi
dosbin net-setup
into /
dosbin livecd-functions.sh
dobin bashlogin
exeinto /usr/bin
doexe opengl-activator
insinto /etc/X11
doins xorg.conf
}
@@ -29,6 +29,7 @@ src_unpack() {
cp ${FILESDIR}/${PV}/xorg.conf . -p
cp ${FILESDIR}/${PV}/bashlogin . -p
cp ${FILESDIR}/${PV}/opengl-activator . -p
cp ${FILESDIR}/${PV}/sabayonlive . -p
}
src_install() {
@@ -50,4 +51,6 @@ src_install() {
insinto /etc/X11
doins xorg.conf
newinitd sabayonlive
}