From 7224c1253228e5c29c78cb3f0f26ce34770f2356 Mon Sep 17 00:00:00 2001 From: BlackNoxis Date: Sat, 15 Feb 2014 23:24:26 +0200 Subject: Added ebuilds for kogaion desktop --- app-misc/rogentoslive-tools/files/1.0/bashlogin | 6 + app-misc/rogentoslive-tools/files/1.0/cdeject | 23 + .../rogentoslive-tools/files/1.0/installer-gui | 26 + .../rogentoslive-tools/files/1.0/installer-text | 21 + .../files/1.0/livecd-functions.sh | 634 ++++++++++++++++++++ app-misc/rogentoslive-tools/files/1.0/livespawn | 10 + app-misc/rogentoslive-tools/files/1.0/logscript.sh | 111 ++++ app-misc/rogentoslive-tools/files/1.0/net-setup | 65 ++ .../rogentoslive-tools/files/1.0/opengl-activator | 318 ++++++++++ .../files/1.0/rogentos-functions.sh | 247 ++++++++ .../files/1.0/rogentos-welcome-loader | 10 + .../files/1.0/rogentos-welcome-loader.desktop | 7 + app-misc/rogentoslive-tools/files/1.0/rogentoslive | 218 +++++++ .../files/1.0/sabayon-live-check | 26 + app-misc/rogentoslive-tools/files/1.0/sabutil | 667 +++++++++++++++++++++ .../rogentoslive-tools/files/1.0/vga-cmd-parser | 53 ++ .../files/1.0/x-setup-configuration | 60 ++ .../rogentoslive-tools/files/1.0/x-setup-init.d | 68 +++ .../90-fglrx-12.1-and-older-workaround.conf | 4 + .../files/1.0/xorg.conf.d/90-synaptics.conf | 58 ++ .../files/1.0/xorg.conf.rogentos | 100 +++ app-misc/rogentoslive-tools/files/2/bashlogin | 6 + app-misc/rogentoslive-tools/files/2/cdeject | 11 + .../rogentoslive-tools/files/2/cdeject.service | 13 + app-misc/rogentoslive-tools/files/2/cdeject.sh | 12 + app-misc/rogentoslive-tools/files/2/installer-gui | 15 + .../files/2/installer-gui.service | 12 + .../rogentoslive-tools/files/2/installer-gui.sh | 8 + app-misc/rogentoslive-tools/files/2/installer-text | 13 + .../files/2/installer-text.service | 11 + .../rogentoslive-tools/files/2/installer-text.sh | 7 + .../rogentoslive-tools/files/2/livecd-functions.sh | 635 ++++++++++++++++++++ app-misc/rogentoslive-tools/files/2/livespawn | 10 + app-misc/rogentoslive-tools/files/2/logscript.sh | 111 ++++ app-misc/rogentoslive-tools/files/2/net-setup | 65 ++ .../files/2/rogentos-functions.sh | 284 +++++++++ .../rogentoslive-tools/files/2/rogentos-live-check | 27 + .../files/2/rogentos-welcome-loader | 10 + .../files/2/rogentos-welcome-loader.desktop | 7 + app-misc/rogentoslive-tools/files/2/rogentoslive | 14 + .../files/2/rogentoslive.service | 11 + .../rogentoslive-tools/files/2/rogentoslive.sh | 183 ++++++ app-misc/rogentoslive-tools/files/2/sabutil | 667 +++++++++++++++++++++ app-misc/rogentoslive-tools/files/2/vga-cmd-parser | 53 ++ .../files/2/x-setup-configuration | 46 ++ app-misc/rogentoslive-tools/files/2/x-setup-init.d | 26 + .../rogentoslive-tools/files/2/x-setup.service | 14 + app-misc/rogentoslive-tools/files/2/x-setup.sh | 49 ++ 48 files changed, 5052 insertions(+) create mode 100755 app-misc/rogentoslive-tools/files/1.0/bashlogin create mode 100644 app-misc/rogentoslive-tools/files/1.0/cdeject create mode 100755 app-misc/rogentoslive-tools/files/1.0/installer-gui create mode 100755 app-misc/rogentoslive-tools/files/1.0/installer-text create mode 100755 app-misc/rogentoslive-tools/files/1.0/livecd-functions.sh create mode 100644 app-misc/rogentoslive-tools/files/1.0/livespawn create mode 100755 app-misc/rogentoslive-tools/files/1.0/logscript.sh create mode 100755 app-misc/rogentoslive-tools/files/1.0/net-setup create mode 100755 app-misc/rogentoslive-tools/files/1.0/opengl-activator create mode 100755 app-misc/rogentoslive-tools/files/1.0/rogentos-functions.sh create mode 100755 app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader create mode 100644 app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader.desktop create mode 100755 app-misc/rogentoslive-tools/files/1.0/rogentoslive create mode 100644 app-misc/rogentoslive-tools/files/1.0/sabayon-live-check create mode 100755 app-misc/rogentoslive-tools/files/1.0/sabutil create mode 100644 app-misc/rogentoslive-tools/files/1.0/vga-cmd-parser create mode 100644 app-misc/rogentoslive-tools/files/1.0/x-setup-configuration create mode 100755 app-misc/rogentoslive-tools/files/1.0/x-setup-init.d create mode 100644 app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf create mode 100644 app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-synaptics.conf create mode 100644 app-misc/rogentoslive-tools/files/1.0/xorg.conf.rogentos create mode 100644 app-misc/rogentoslive-tools/files/2/bashlogin create mode 100644 app-misc/rogentoslive-tools/files/2/cdeject create mode 100644 app-misc/rogentoslive-tools/files/2/cdeject.service create mode 100644 app-misc/rogentoslive-tools/files/2/cdeject.sh create mode 100644 app-misc/rogentoslive-tools/files/2/installer-gui create mode 100644 app-misc/rogentoslive-tools/files/2/installer-gui.service create mode 100644 app-misc/rogentoslive-tools/files/2/installer-gui.sh create mode 100644 app-misc/rogentoslive-tools/files/2/installer-text create mode 100644 app-misc/rogentoslive-tools/files/2/installer-text.service create mode 100644 app-misc/rogentoslive-tools/files/2/installer-text.sh create mode 100644 app-misc/rogentoslive-tools/files/2/livecd-functions.sh create mode 100644 app-misc/rogentoslive-tools/files/2/livespawn create mode 100644 app-misc/rogentoslive-tools/files/2/logscript.sh create mode 100644 app-misc/rogentoslive-tools/files/2/net-setup create mode 100644 app-misc/rogentoslive-tools/files/2/rogentos-functions.sh create mode 100644 app-misc/rogentoslive-tools/files/2/rogentos-live-check create mode 100644 app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader create mode 100644 app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader.desktop create mode 100644 app-misc/rogentoslive-tools/files/2/rogentoslive create mode 100644 app-misc/rogentoslive-tools/files/2/rogentoslive.service create mode 100644 app-misc/rogentoslive-tools/files/2/rogentoslive.sh create mode 100644 app-misc/rogentoslive-tools/files/2/sabutil create mode 100644 app-misc/rogentoslive-tools/files/2/vga-cmd-parser create mode 100644 app-misc/rogentoslive-tools/files/2/x-setup-configuration create mode 100644 app-misc/rogentoslive-tools/files/2/x-setup-init.d create mode 100644 app-misc/rogentoslive-tools/files/2/x-setup.service create mode 100644 app-misc/rogentoslive-tools/files/2/x-setup.sh (limited to 'app-misc/rogentoslive-tools/files') diff --git a/app-misc/rogentoslive-tools/files/1.0/bashlogin b/app-misc/rogentoslive-tools/files/1.0/bashlogin new file mode 100755 index 00000000..34689189 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/bashlogin @@ -0,0 +1,6 @@ +#!/bin/bash + +cat /etc/motd 2>/dev/null +cd /root +[[ -e .bash_profile ]] && source .bash_profile +exec -l /bin/bash -i diff --git a/app-misc/rogentoslive-tools/files/1.0/cdeject b/app-misc/rogentoslive-tools/files/1.0/cdeject new file mode 100644 index 00000000..6d56f043 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/cdeject @@ -0,0 +1,23 @@ +#!/sbin/runscript +# Copyright (c) 2010 Fabio Erculiani +# All rights reserved. Released under the 2-clause BSD license. + +description="Eject LiveCD/DVD at live system shutdown/reboot" + +depend() +{ + after * +} + +start() +{ + is_live=$(cat /proc/cmdline | grep cdroot) + if [ -n "${is_live}" ]; then + cdrom_dev=$(cat /proc/mounts | grep " /mnt/cdrom " | cut -d" " -f 1) + # check if /mnt/cdrom device is a cdrom device + if [ "${cdrom_dev}" = /dev/sr* ] || [ "${cdrom_dev}" = /dev/cdrom* ]; then + eject -mp "${cdrom_dev}" &> /dev/null + fi + fi + eend 0 +} diff --git a/app-misc/rogentoslive-tools/files/1.0/installer-gui b/app-misc/rogentoslive-tools/files/1.0/installer-gui new file mode 100755 index 00000000..d8fd3dc0 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/installer-gui @@ -0,0 +1,26 @@ +#!/sbin/runscript +# Copyright 2006 Sabayon Linux +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before xdm + after rogentos + need dbus +} + +start() { + + source /sbin/rogentos-functions.sh + + if sabayon_is_gui_install; then + ebegin "Rogentos Linux GUI Installer service" + # Enable autologin + sabayon_setup_autologin + # Setup GUI installer + sabayon_setup_gui_installer + eend 0 + fi + + return 0 + +} diff --git a/app-misc/rogentoslive-tools/files/1.0/installer-text b/app-misc/rogentoslive-tools/files/1.0/installer-text new file mode 100755 index 00000000..ce431e53 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/installer-text @@ -0,0 +1,21 @@ +#!/sbin/runscript +# Copyright 2006 Sabayon Linux +# Distributed under the terms of the GNU General Public License v2 + +depend() { + after * +} + +start() { + + source /sbin/rogentos-functions.sh + + if sabayon_is_text_install; then + ebegin "Rogentos Linux Text Installer service" + eend 0 + sabayon_setup_text_installer + fi + + + +} diff --git a/app-misc/rogentoslive-tools/files/1.0/livecd-functions.sh b/app-misc/rogentoslive-tools/files/1.0/livecd-functions.sh new file mode 100755 index 00000000..b65a5f80 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/livecd-functions.sh @@ -0,0 +1,634 @@ +#!/bin/bash + +# Global Variables: +# CDBOOT -- is booting off CD +# LIVECD_CONSOLE -- console that is specified on commandline +# -- (ttyS0, 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" ]] && \ + [[ -e /etc/init.d/functions.sh ]] && \ + source /etc/init.d/functions.sh + +# emulating einfo since it's not always available from functions.sh +# FIXME: fix functions.sh +einfo() { + [[ -x "/lib/rc/bin/einfo" ]] && /lib/rc/bin/einfo "${1}"\ + || echo "* ${1}" +} + +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 + 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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${iface}.SSID) + if [ -n "${SSID}" ] + then + echo "" >> /etc/conf.d/net + echo "# This wireless configuration file was built by net-setup" > /etc/conf.d/net + WEP=$(tail -n 1 ${iface}.WEPTYPE) + case ${WEP} in + 1) + WEP_TYPE=$(tail -n 1 ${iface}.WEPTYPE) + if [ -n "${WEP_TYPE}" ] + then + WEP_KEY=$(tail -n 1 ${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/net + ;; + 2) + echo "key_${SSID_TRANS}=\"s:${WEP_KEY} enc open\"" >> /etc/conf.d/net + ;; + esac + fi + fi + ;; + 2) + : + ;; + esac + echo "preferred_aps=( \"${SSID}\" )" >> /etc/conf.d/net + echo "associate_order=\"forcepreferredonly\"" >> /etc/conf.d/net + 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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${iface}.BC) + dialog --title "Network mask" --inputbox "Please enter a Network Mask for ${iface}:" 20 50 "255.255.255.0" 2> ${iface}.NM + NETMASK=$(tail -n 1 ${iface}.NM) + dialog --title "Gateway" --inputbox "Please enter a Gateway for ${iface} (hit enter for none:)" 20 50 2> ${iface}.GW + GATEWAY=$(tail -n 1 ${iface}.GW) + dialog --title "DNS server" --inputbox "Please enter a name server to use (hit enter for none:)" 20 50 2> ${iface}.DNS + DNS=$(tail -n 1 ${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=$(tail -n 1 ${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 "# Rogentos Linux static network configuration tool" > /etc/conf.d/net + DHCP=$(tail -n 1 ${iface}.DHCP) + case ${DHCP} in + 1) + echo "config_${iface}=\"dhcp\"" >> /etc/conf.d/net + echo "dhcp_${iface}=\"nosendhost\"" >> /etc/conf.d/net + ;; + 2) + IP=$(tail -n 1 ${iface}.IP) + BROADCAST=$(tail -n 1 ${iface}.BC) + NETMASK=$(tail -n 1 ${iface}.NM) + GATEWAY=$(tail -n 1 ${iface}.GW) + DNS="$(tail -n 1 ${iface}.DNS)" + DOMAIN="$(tail -n 1 ${iface}.SUFFIX)" + if [ -n "${IP}" -a -n "${BROADCAST}" -a -n "${NETMASK}" ] + then + echo "config_${iface}=\"${IP} netmask ${NETMASK} broadcast ${BROADCAST}\"" >> /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} +} + +livecd_rev_string() { + # /usr might not be mounted + local copy=${1} + len=${#copy} + for((i=$len-1;i>=0;i--)); do rev="$rev${copy:$i:1}"; done + echo ${rev} +} + +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}" + + eval dialog --menu \"Please select the interface that you wish to configure from the list below:\" 0 0 0 $opts 2>iface + [[ "$?" == "1" ]] && exit + + 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=$(livecd_rev_string $1 | 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=$(livecd_rev_string $1 | 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" + RC_NO_UMOUNTS="^(/|/dev|/dev/pts|/lib/rcscripts/init.d|/proc|/proc/.*|/sys|/mnt/livecd|/newroot)$" + export CDBOOT RC_NO_UMOUNTS + ;; + cdroot\=*) + CDBOOT="yes" + RC_NO_UMOUNTS="^(/|/dev|/dev/pts|/lib/rcscripts/init.d|/proc|/proc/.*|/sys|/mnt/livecd|/newroot)$" + export CDBOOT RC_NO_UMOUNTS + ;; + 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 + 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 + 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 +} diff --git a/app-misc/rogentoslive-tools/files/1.0/livespawn b/app-misc/rogentoslive-tools/files/1.0/livespawn new file mode 100644 index 00000000..44d7257e --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/livespawn @@ -0,0 +1,10 @@ +#!/usr/bin/python +import sys, os, subprocess +args = sys.argv[1:] +if not args: raise SystemExit(1) + +pid = os.fork() +if pid == 0: + p = subprocess.Popen(args) + rc = p.wait() + raise SystemExit(rc) diff --git a/app-misc/rogentoslive-tools/files/1.0/logscript.sh b/app-misc/rogentoslive-tools/files/1.0/logscript.sh new file mode 100755 index 00000000..4fb06d6b --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/logscript.sh @@ -0,0 +1,111 @@ +#!/bin/sh +#requires the following +# free, hostname, grep, cut, awk, uname + +HOSTNAME=`hostname -s` +IP_ADDRS=`ifconfig | grep 'inet addr' | grep -v '255.0.0.0' | cut -f2 -d':' | awk '{print $1}'` +IP_ADDRS=`echo $IP_ADDRS | sed 's/\n//g'` + +#memory +MEMORY=`free | grep Mem | awk '{print $2}'` + +#cpu info +CPUS=`cat /proc/cpuinfo | grep processor | wc -l | awk '{print $1}'` +CPU_MHZ=`cat /proc/cpuinfo | grep MHz | tail -n1 | awk '{print $4}'` +CPU_TYPE=`cat /proc/cpuinfo | grep vendor_id | tail -n 1 | awk '{print $3}'` +CPU_TYPE2=`uname -m` +CPU_TYPE3=`uname -p` + +OS_NAME=`uname -s` +OS_OS=`uname -o` +OS_KERNEL=`uname -r` +OS_RELEASE=`cat /etc/rogentos-edition` +OS_EDITION=`cat /etc/rogentos-edition` +ESELECT_KERNEL=`eselect --no-color kernel list` +ESELECT_OPENGL=`eselect --no-color opengl list` +ESELECT_JAVA=`eselect --no-color java-vm list` +ESELECT_JAVAP=`eselect --no-color java-nsplugin list` + +EQUO=`equo --version` +PORTAGE=`emerge --version` + +UPTIME=`uptime` +MEM=`free -t -m` +SPACE=`df -TH` + +PCIINFO=`lspci | cut -f3 -d':'` +#Another way to do it +#PCIINFO=`lspci | cut -f3 -d':'` + +LSUSB=`lsusb` +LSMOD=`lsmod` +#print it out +echo "$HOSTNAME" +echo "--------------------------------------------------------------------" +echo "Hostname : $HOSTNAME" +echo "Host Address : $IP_ADDRS" +echo "Main Memory : $MEMORY" +echo "Number of CPUs : $CPUS" +echo "CPU Type : $CPU_TYPE2 $CPU_TYPE3 $CPU_MHZ MHz" +echo "OS Release : $OS_RELEASE" +echo "OS Edition : $OS_EDITION" +echo "Kernel Name : $OS_NAME $OS_OS" +echo "Kernel Version : $OS_KERNEL" +echo "Uptime : $UPTIME" +echo "--------------------------------------------------------------------" +echo +echo "Entropy Version" +echo "$EQUO" +echo +echo "Portage Version" +echo "$PORTAGE" +echo "--------------------------------------------------------------------" +echo +echo "Kernel List" +echo "$ESELECT_KERNEL" +echo "Your Kernel Should Be Set To:" +echo "$OS_KERNEL" +echo "Use eselect kernel set #" +echo "--------------------------------------------------------------------" +echo +echo "OpenGL List" +echo "$ESELECT_OPENGL" +echo "The above should be set to your video card, see lspci" +echo "Use eselect opengl set #" +echo "--------------------------------------------------------------------" +echo +echo "Java VM List" +echo "$ESELECT_JAVA" +echo "Use java-config --set-system-vm #" +echo "--------------------------------------------------------------------" +echo +echo "Java-nsplugin List" +echo "$ESELECT_JAVAP" +echo "Use eselect java-nsplugin set #" +echo "--------------------------------------------------------------------" +echo +echo "Devices - lspci" +echo "--------------------------------------------------------------------" +echo "$PCIINFO" +echo "--------------------------------------------------------------------" +echo +echo "Devices - lsmod" +echo "--------------------------------------------------------------------" +echo "$LSMOD" +echo "--------------------------------------------------------------------" +echo +echo "Devices - lsusb" +echo "--------------------------------------------------------------------" +echo "$LSUSB" +echo "--------------------------------------------------------------------" +echo +echo "Memory" +echo "--------------------------------------------------------------------" +echo "$MEM" +echo "--------------------------------------------------------------------" +echo +echo "Disk Space" +echo "--------------------------------------------------------------------" +echo "$SPACE" +echo "--------------------------------------------------------------------" +echo diff --git a/app-misc/rogentoslive-tools/files/1.0/net-setup b/app-misc/rogentoslive-tools/files/1.0/net-setup new file mode 100755 index 00000000..e84de48b --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/net-setup @@ -0,0 +1,65 @@ +#!/bin/bash +# Copyright 1999-2005 Gentoo Foundation +# Copyright 2006-2008 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=$(tail -n 1 ${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 diff --git a/app-misc/rogentoslive-tools/files/1.0/opengl-activator b/app-misc/rogentoslive-tools/files/1.0/opengl-activator new file mode 100755 index 00000000..387dd10f --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/opengl-activator @@ -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 + rm -f "${file}" || echo -q "Failed to delete ${file}" + 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}} + + # First make sure we have an opengl directory and this is a real lib dir, not a symlink + [[ -d ${PREFIX}/${libdir}/opengl && ! -h ${PREFIX}/${libdir} ]] || continue + + # 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 lib{wfb,glx,dri,dri2}.{a,so,la}; do + rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/${libdir}/${moduledir}/extensions/${file}" + 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 + sed -i '/setenv LDPATH=.*/d' /etc/csh.env + sed -i '/export LD_LIBRARY_PATH=.*/d' /etc/profile.env + sed -i '/setenv LD_LIBRARY_PATH=.*/d' /etc/csh.env + sed -i "s/OPENGL_PROFILE=.*/OPENGL_PROFILE='${gl_implem}'/" /etc/profile.env + sed -i "s/OPENGL_PROFILE=.*/OPENGL_PROFILE='${gl_implem}'/" /etc/csh.env + sed -i '/LD_LIBRARY_PATH=.*/d' ${ENV_FILE} + sed -i "s/OPENGL_PROFILE=.*/OPENGL_PROFILE=\"${gl_implem}\"/" ${ENV_FILE} + + echo "export LDPATH='"${ldpath}":"${oldldpath}"'" >> /etc/profile.env + echo "setenv LDPATH='"${ldpath}":"${oldldpath}"'" >> /etc/csh.env + echo "export LD_LIBRARY_PATH='"${ldpath}"'" >> /etc/profile.env + echo "setenv LD_LIBRARY_PATH='"${ldpath}"'" >> /etc/csh.env + echo 'LD_LIBRARY_PATH="'${ldpath}'"' >> ${ENV_FILE} + + + 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} + rc=$? + 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 + ldconfig -X &> /dev/null + return ${rc} + 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 diff --git a/app-misc/rogentoslive-tools/files/1.0/rogentos-functions.sh b/app-misc/rogentoslive-tools/files/1.0/rogentos-functions.sh new file mode 100755 index 00000000..eb4bf4d6 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/rogentos-functions.sh @@ -0,0 +1,247 @@ +#!/bin/bash + +GDM_FILE="/usr/share/gdm/defaults.conf" +CUSTOM_GDM_FILE="/etc/gdm/custom.conf" +KDM_FILE="/usr/share/config/kdm/kdmrc" +LXDM_FILE="/etc/lxdm/lxdm.conf" +OEM_FILE="/etc/oemlive.sh" +OEM_FILE_NEW="/etc/oem/liveboot.sh" +LIVE_USER_GROUPS="audio bumblebee cdrom cdrw clamav console entropy games \ +kvm lp lpadmin messagebus plugdev polkituser portage pulse pulse-access pulse-rt \ +scanner usb users uucp vboxguest vboxusers video wheel" +LIVE_USER=${SABAYON_USER:-rogentosuser} + +sabayon_setup_autologin() { + # GDM - GNOME + if [ -f "${GDM_FILE}" ]; then + sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=true/" ${GDM_FILE} + sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${LIVE_USER}/" ${GDM_FILE} + + sed -i "s/^TimedLoginEnable=.*/TimedLoginEnable=true/" ${GDM_FILE} + sed -i "s/^TimedLogin=.*/TimedLogin=${LIVE_USER}/" ${GDM_FILE} + sed -i "s/^TimedLoginDelay=.*/TimedLoginDelay=0/" ${GDM_FILE} + + elif [ -f "${CUSTOM_GDM_FILE}" ]; then + # FIXME: if this is called multiple times, it generates duplicated entries + sed -i "s:\[daemon\]:\[daemon\]\nAutomaticLoginEnable=true\nAutomaticLogin=${LIVE_USER}\nTimedLoginEnable=true\nTimedLogin=${LIVE_USER}\nTimedLoginDelay=0:" \ + "${CUSTOM_GDM_FILE}" + # change other entries there + sed -i "s/^TimedLogin=.*/TimedLogin=${LIVE_USER}/" "${CUSTOM_GDM_FILE}" + sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${LIVE_USER}/" "${CUSTOM_GDM_FILE}" + fi + + # KDM - KDE + if [ -f "$KDM_FILE" ]; then + sed -i "s/AutoLoginEnable=.*/AutoLoginEnable=true/" $KDM_FILE + sed -i "s/AutoLoginUser=.*/AutoLoginUser=${LIVE_USER}/" $KDM_FILE + sed -i "s/AutoLoginDelay=.*/AutoLoginDelay=0/" $KDM_FILE + sed -i "s/AutoLoginAgain=.*/AutoLoginAgain=true/" $KDM_FILE + + sed -i "s/AllowRootLogin=.*/AllowRootLogin=true/" $KDM_FILE + sed -i "s/AllowNullPasswd=.*/AllowNullPasswd=true/" $KDM_FILE + sed -i "s/AllowShutdown=.*/AllowShutdown=All/" $KDM_FILE + + sed -i "/^#.*AutoLoginEnable=/ s/^#//" $KDM_FILE + sed -i "/^#.*AutoLoginUser=/ s/^#//" $KDM_FILE + sed -i "/^#.*AutoLoginDelay=/ s/^#//" $KDM_FILE + sed -i "/^#.*AutoLoginAgain=/ s/^#//" $KDM_FILE + + sed -i "/^#AllowRootLogin=/ s/^#//" $KDM_FILE + sed -i "/^#AllowNullPasswd=/ s/^#//" $KDM_FILE + sed -i "/^#AllowShutdown=/ s/^#//" $KDM_FILE + fi + + # LXDM + if [ -f "$LXDM_FILE" ]; then + sed -i "s/autologin=.*/autologin=${LIVE_USER}/" $LXDM_FILE + sed -i "/^#.*autologin=/ s/^#//" $LXDM_FILE + fi + + # Setup correct login session + sabayon_is_normal_boot && sabayon_fixup_gnome_autologin_session +} + +sabayon_disable_autologin() { + # GDM - GNOME + if [ -f "${GDM_FILE}" ]; then + sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=false/" ${GDM_FILE} + fi + + # KDM - KDE + KDM_FILE="/usr/share/config/kdm/kdmrc" + if [ -f "$KDM_FILE" ]; then + sed -i "s/AutoLoginEnable=.*/AutoLoginEnable=false/" $KDM_FILE + fi +} + +sabayon_setup_live_user() { + local live_user="${1}" + local live_uid="${2}" + if [ -z "${live_user}" ]; then + live_user="${LIVE_USER}" + fi + if [ -n "${live_uid}" ]; then + live_uid="-u ${live_uid}" + fi + id ${live_user} &> /dev/null + if [ "${?}" != "0" ]; then + local live_groups="" + local avail_groups=$(cat /etc/group | cut -d":" -f 1 | xargs echo) + for a_group in ${avail_groups}; do + for p_group in ${LIVE_USER_GROUPS}; do + if [ "${p_group}" = "${a_group}" ]; then + if [ -z "${live_groups}" ]; then + live_groups="${p_group}" + else + live_groups="${live_groups},${p_group}" + fi + fi + done + done + # then setup live user, that is missing + useradd -d "/home/${live_user}" -g root -G ${live_groups} -c "rogentosuser" \ + -m -N -p "" -s /bin/bash ${live_uid} "${live_user}" + return 0 + fi + return 1 +} + +sabayon_setup_motd() { + echo -e "\n\tWelcome to `cat /etc/rogentos-edition`\n\t`uname -p`\n\t`uname -o` `uname -r`\n" > /etc/motd +} + +sabayon_setup_vt_autologin() { + source /sbin/livecd-functions.sh + export CDBOOT=1 + livecd_fix_inittab +} + +sabayon_setup_oem_livecd() { + if [ -x "${OEM_LIVE_NEW}" ]; then + ${OEM_FILE_NEW} || return 1 + elif [ -x "${OEM_LIVE}" ]; then + ${OEM_FILE} || return 1 + fi + return 0 +} + +sabayon_is_live() { + local cmdl=$(cat /proc/cmdline | grep cdroot) + if [ -n "${cmdl}" ]; then + return 0 + else + return 1 + fi +} + +sabayon_setup_gui_installer() { + # Configure Fluxbox + local dmrc_file="/home/${LIVE_USER}/.dmrc" + local flux_dir="/home/${LIVE_USER}/.fluxbox" + local flux_startup_file="${flux_dir}/startup" + chown ${LIVE_USER} "${dmrc_file}" + chown ${LIVE_USER} "/home/${LIVE_USER}/.fluxbox + if [ ! -d "${flux_dir}" ]; then + mkdir "${flux_dir}" && chown "${LIVE_USER}" "${flux_dir}" + fi + echo "[Desktop]" > "${dmrc_file}" + echo "Session=fluxbox" >> "${dmrc_file}" + chown rogentosuser "${dmrc_file}" + sed -i "/installer --fullscreen/ s/^# //" "${flux_startup_file}" + if [ -x "/usr/libexec/gdm-set-default-session" ]; then + # oh my fucking glorious god, this + # is AccountsService bullshit + # cross fingers + /usr/libexec/gdm-set-default-session fluxbox + fi + if [ -x "/usr/libexec/gdm-set-session" ]; then + # GDM 3.6 support + /usr/libexec/gdm-set-session sabayonuser fluxbox + fi + chown ${LIVE_USER} "${dmrc_file}" + chown ${LIVE_USER} "/home/${LIVE_USER}/.fluxbox +} + +# This function reads /etc/skel/.dmrc and properly +# set the Session= value inside AccountsService. +# Blame the idiots who broke de-facto standards +# and created this fugly thing called AccountsService +sabayon_fixup_gnome_autologin_session() { + local cur_session= + + if [ -f "/etc/skel/.dmrc" ]; then + cur_session=$(cat /etc/skel/.dmrc | grep ^Session | cut -d"=" -f 2) + fi + if [ -z "${cur_session}" ]; then + return 0 + fi + + local sess_file="/usr/share/xsessions/${cur_session}.desktop" + if [ ! -f "${sess_file}" ]; then + return 0 + fi + + if [ -x "/usr/libexec/gdm-set-default-session" ]; then + # this edits /etc/gdm/custom.conf adding [daemon]\nDefaultSession=${cur_session} + /usr/libexec/gdm-set-default-session "${cur_session}" + fi + + if [ -x "/usr/libexec/gdm-set-session" ]; then + # GDM 3.6 support + local users_in_users=$(cat /etc/group | grep "^users" | awk -F':' '{ print $4 }' | sed "s:,: :g") + for usr in ${users_in_users}; do + /usr/libexec/gdm-set-session "${usr}" "${cur_session}" + done + fi +} + +sabayon_setup_text_installer() { + # switch to verbose mode + splash_manager -c set -t default -m v &> /dev/null + reset + chvt 1 + clear + echo "Welcome to Rogentos Linux Text installation." >> /etc/motd + echo "root password: root" >> /etc/motd + echo "to run the installation type: installer " >> /etc/motd +} + +sabayon_is_text_install() { + local _is_install=$(cat /proc/cmdline | grep installer-text) + if [ -n "${_is_install}" ]; then + return 0 + else + return 1 + fi +} + +sabayon_is_gui_install() { + local _is_install=$(cat /proc/cmdline | grep installer-gui) + if [ -n "${_is_install}" ]; then + return 0 + else + return 1 + fi +} + +sabayon_is_live_install() { + ( sabayon_is_text_install || sabayon_is_gui_install ) && return 0 + return 1 +} + +sabayon_is_mce() { + local _is_mce=$(cat /proc/cmdline | grep sabayonmce) + if [ -n "${_is_mce}" ]; then + return 0 + else + return 1 + fi +} + +sabayon_is_normal_boot() { + if ! sabayon_is_mce && ! sabayon_is_live_install; then + return 0 + else + return 1 + fi +} diff --git a/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader b/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader new file mode 100755 index 00000000..0bb12f2b --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader @@ -0,0 +1,10 @@ +#!/bin/sh + +SABAYON_LOADER="/usr/bin/xdg-open" +SABAYON_URL=${SABAYON_URL:-http://www.sabayon.org?install_welcome=1} + +# load Sabayon URL +[[ -x "${SABAYON_LOADER}" ]] && ${SABAYON_LOADER} ${SABAYON_URL} & + +# remove myself from autostart +rm ~/.config/autostart/sabayon-welcome-loader.desktop -f diff --git a/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader.desktop b/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader.desktop new file mode 100644 index 00000000..e5ea4b3d --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=sabayon-loader +Exec=sabayon-welcome-loader +Icon=system-run +Comment=Sabayon Linux post-install Welcome Screen +Terminal=false diff --git a/app-misc/rogentoslive-tools/files/1.0/rogentoslive b/app-misc/rogentoslive-tools/files/1.0/rogentoslive new file mode 100755 index 00000000..4a65b73e --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/rogentoslive @@ -0,0 +1,218 @@ +#!/sbin/runscript +# Copyright 2004-2009 Fabio Erculiani +# Distributed under the terms of the GNU General Public License v2 + +. /sbin/rogentos-functions.sh + +depend() { + after x-setup + before hald + before xdm +} + +prepare_fluxbox_locked_autologin() { + + # change default wm to fluxbox + echo "[Desktop]" > /home/${LIVE_USER}/.dmrc + echo "Session=fluxbox" >> /home/${LIVE_USER}/.dmrc + chown ${LIVE_USER} /home/${LIVE_USER}/.dmrc + # Change passwords for security + echo root:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1 + echo ${LIVE_USER}:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1 + +} + +my_setup_desktop() { + + # create LIVE_USER if it does not exist + sabayon_setup_live_user "${LIVE_USER}" "1000" + if [ "${?}" = "1" ]; then + # if user is already available, then setup skel + # Copy ${LIVE_USER} directory + rm -rf /home/${LIVE_USER} + cp /etc/skel /home/${LIVE_USER} -Rp + chown ${LIVE_USER}:users /home/${LIVE_USER} -R + fi + + liveinst_desktop="/usr/share/applications/liveinst.desktop" + liveinst_desktop_name="$(basename ${liveinst_desktop})" + if [ -f "${liveinst_desktop}" ]; then + [[ -d "/home/${LIVE_USER}/Desktop" ]] || mkdir -p /home/${LIVE_USER}/Desktop + cp "${liveinst_desktop}" /home/${LIVE_USER}/Desktop + chown ${LIVE_USER}:users /home/${LIVE_USER}/Desktop -R + chmod +x /home/${LIVE_USER}/Desktop/${liveinst_desktop_name} + rm -f /etc/skel/Desktop/Anaconda*.desktop + rm -f /home/${LIVE_USER}/Desktop/Anaconda*.desktop + fi + + # Disable memory eating services + rm -f /etc/xdg/autostart/hplip-systray.desktop + rm -f /etc/xdg/autostart/beagle-search-autostart.desktop + rm -f /etc/xdg/autostart/tracker*.desktop + rm -f /etc/xdg/autostart/magneto.desktop + rm -f /etc/xdg/autostart/beagled-autostart.desktop + rm -f /usr/share/autostart/magneto.desktop + rm -f /usr/share/autostart/nepomukserver.desktop + + # Remove broken entries in /etc/mtab + sed -i '/.*newroot.*/d' /etc/mtab + + # Create /media for removable devices + if [ ! -d /media ]; then + mkdir /media + chmod 755 /media + fi + + # Add sudo to gparted exec= + gparted_file="/home/${LIVE_USER}/Desktop/gparted.desktop" + if [ -f "${gparted_file}" ]; then + sed -i 's/Exec=/Exec=sudo /' "${gparted_file}" + fi + + # create /overlay, this way df -h won't bitch + [[ -d "/overlay" ]] || mkdir /overlay + +} + +my_setup_password() { + + 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 ${LIVE_USER}:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1 + echo + fi + +} + +my_setup_keymap() { + + # 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) + ;; + console-setup/modelcode=*) + keymap_toset_model="-$(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 + aggregated_keymap="${keymap_toset}${keymap_toset_model}" + /sbin/keyboard-setup-2 ${aggregated_keymap} all &> /dev/null + if [ "${?}" = "0" ]; then + /etc/init.d/keymaps restart --nodeps + fi + fi + + fi + +} + +my_wait_opengl_config() { + + echo -en "\E[33;36m * \E[0m \E[01;32m Waiting for Graphical Configurator to finish... \E[0m" + while [ -e "/etc/x-setup-configuration-running" ] + do + # waiting... + sleep 1 + done + echo -e "Done" + +} + +my_setup_locale() { + + 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 + if [ -n "$lang_toset" ]; then + /sbin/language-setup $lang_toset &> /dev/null + fi + + fi + +} + +start() { + + # Perform configuration only in live mode + if ! sabayon_is_live; then + einfo "Skipping live mode configuration" + return 0 + fi + + my_setup_desktop + my_setup_password + my_setup_keymap + my_wait_opengl_config + # MOVED HERE TO AVOID RACE CONDITIONS ON WRITING /etc/profile.env variables + # Check if LANG is forced by cmdline + my_setup_locale + # setup autologin for all the supported Login managers + sabayon_setup_autologin + # override autostart stuff if required: + sabayon_setup_motd + sabayon_setup_vt_autologin + sabayon_setup_oem_livecd + +} diff --git a/app-misc/rogentoslive-tools/files/1.0/sabayon-live-check b/app-misc/rogentoslive-tools/files/1.0/sabayon-live-check new file mode 100644 index 00000000..4dc2e739 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/sabayon-live-check @@ -0,0 +1,26 @@ +#!/bin/sh +# +# sabayon_livechk.sh +# +# Checks the integrity of a LiveCD/DVD by passing the +# contents of the image through a md5sum (to be compared +# with an documented value elsewhere). +# + +if ( ! isoinfo -d -i /dev/cdrom >>/dev/null 2>/dev/null ); then + echo "CDROM/DVD image not found!" + exit 1 +fi + +echo -e "Checking image integrity, please allow several minutes...\n" +echo "You can check for errors by running 'tail /var/log/messages'" +echo "in another console window. If you encounter multiple device" +echo "errors with you cdrom, this probably indicates the test is failing." +echo "You may type 'Ctrl-c' to abort the check." + +BLOCK_SIZE=`isoinfo -d -i /dev/cdrom | grep "Logical block size is" | cut -d: -f2 | sed 's/^[ ]//g'` +VOL_SIZE=`isoinfo -d -i /dev/cdrom | grep "Volume size is" | cut -d: -f2 | sed 's/^[ ]//g'` +dd if=/dev/cdrom bs=$BLOCK_SIZE count=$VOL_SIZE conv=notrunc,noerror | md5sum + +echo "Compare the above value with the value supplied in" +echo "the release notes for this version at:" diff --git a/app-misc/rogentoslive-tools/files/1.0/sabutil b/app-misc/rogentoslive-tools/files/1.0/sabutil new file mode 100755 index 00000000..680a6d1e --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/sabutil @@ -0,0 +1,667 @@ +#!/bin/bash + +# Initial version by wolfden. +# Later changes by Enlik . + +# last change: 9.03.2012 +# most important changes to last version: +# - abort if non root where needs root permissions +# - fix fdisk -l pasting +# - support for xorg.conf.d +# - reorder options and add rcupdate_pastebin + +USER=$(whoami) +HOMEDIR=${HOME:-/tmp} + +function menu +{ + local selection="" + until [[ "$selection" = "0" ]] ; do + echo "Current Operating System:" + cat /etc/sabayon-release + echo "" + echo "Current Edition:" + cat /etc/rogentos-edition + echo + echo "Pick a choice from menu below:" + + echo "" + echo "1 - Backup & edit xorg.conf and xorg.conf.d" + echo "2 - Restore xorg.conf and xorg.conf.d from backup" + echo "3 - Regenerate Sabayon xorg.conf" + echo "4 - Backup & edit grub.cfg" + echo "5 - Restore grub.cfg from backup" + echo "----------------------------------------" + echo "View and AutoPaste:" + echo " " + echo "01 - Pastebin Xorg configuration files" + echo "02 - Pastebin Xorg.0.log" + echo "03 - Pastebin ~/.xsession-errors" + echo "04 - Pastebin grub.cfg (bootmanager settings)" + echo "05 - Pastebin /var/log/dmesg" + echo "06 - Pastebin system and hardware info" + echo "07 - Pastebin fdisk -l (list the partition tables)" + echo "08 - Pastebin rc-update show (show enabled services and the runlevels)" + echo "09 - Pastebin rc.log" + echo "10 - Pastebin /var/log/messages" + echo "11 - Pastebin kdm.log" + echo "" + echo "0 - Exit" + echo "" + echo -n "Enter selection: " + read selection + echo "" + + case $selection in + 1 ) xorg_backup ; press_enter ; xorg_edit; press_enter ;; + 2 ) xorg_restore ; press_enter ;; + 3 ) xorg_regen ; press_enter ;; + 4 ) grub_backup ; press_enter ; nano -w /boot/grub/grub.cfg; press_enter ;; + 5 ) grub_restore ; press_enter ;; + 01 ) xorg_pastebin ; press_enter ;; + 02 ) xorg0log_pastebin ; press_enter ;; + 03 ) xsessionerrors_pastebin ; press_enter ;; + 04 ) grub_pastebin ; press_enter ;; + 05 ) dmesg_pastebin ; press_enter ;; + 06 ) system_pastebin ; press_enter ;; + 07 ) fdisk_pastebin ; press_enter ;; + 08 ) rcupdate_pastebin ; press_enter ;; + 09 ) rclog_pastebin ; press_enter ;; + 10 ) messages_pastebin ; press_enter ;; + 11 ) kdm_pastebin ; press_enter ;; + + 0 ) ;; + * ) echo "Please be sensible - choose a number that exists in the menu"; press_enter + esac + done + +} + +function press_enter +{ + echo "" + echo -n "Press Enter to continue" + read + clear +} + +function is_root +{ + if [[ $USER != "root" ]]; then + echo "You need to be root to do this." >&2 + return 1 + fi + return 0 +} + +function xorg_regen +{ + is_root || return + + if [[ ! -f "/etc/X11/xorg.conf.rogentos" ]]; then + cat > /etc/X11/xorg.conf.rogentos <=275.xx.xx drivers + #Option "UseEvents" "True" +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 + + SubSection "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" + +EndSection + +Section "DRI" + Mode 0666 +EndSection + +Section "Extensions" + #Option "Composite" "Enable" +EndSection +EOF + fi + + mv -f /etc/X11/xorg.conf /etc/X11/xorg.conf.old + /usr/sbin/x-setup-configuration + + echo "Note: you may want to look to /etc/X11/xorg.conf.d (if it exists), too." +} + +function xorg_backup +{ + is_root || return + + if [[ -f /etc/X11/xorg.conf.BKUP ]]; then + echo "/etc/X11/xorg.conf.BKUP already exists, so new backup wasn't made - aborting." + echo "Now off we go to edit the file...." + return + elif [[ -e /etc/X11/xorg.conf.d.BKUP ]]; then + echo "/etc/X11/xorg.conf.d.BKUP backup already exists, so new backup wasn't made - aborting." + return + fi + + # Delete backup file. If there's no xorg.conf, no stale xorg.conf.BKUP will be kept. + # So xorg_restore will not made new (unexpected) xorg.conf from xorg.conf.BKUP. + rm -f /etc/X11/xorg.conf.BKUP + if [[ -f /etc/X11/xorg.conf ]]; then + echo "Making backup of xorg.conf as /etc/X11/xorg.conf.BKUP" + cp /etc/X11/xorg.conf /etc/X11/xorg.conf.BKUP + else + echo "There's no /etc/X11/xorg.conf so it couldn't be backed up." + fi + + if [[ -e /etc/X11/xorg.conf.d ]]; then + echo "Making backup of /etc/X11/xorg.conf.d/*" + if [[ ! -d /etc/X11/xorg.conf.d ]]; then + echo "!!!" + echo "/etc/X11/xorg.conf.d is not a directory!" + return + fi + mkdir -p /etc/X11/xorg.conf.d.BKUP + rm -f /etc/X11/xorg.conf.d.BKUP/* # dotfiles and subdirectories (who keeps them there?!) are left untouched + cp /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf.d.BKUP/ # and not copied (that's fine) + echo "/etc/X11/xorg.conf.d/* files are backed up in /etc/X11/xorg.conf.d.BKUP/" + else + echo "There's no /etc/X11/xorg.conf.d (directory) so it couldn't be backed up." + fi + + echo "" + echo "INTEL graphics users please read the url below before proceding" + echo "" + echo "http://gentoo-wiki.com/HOWTO_Intel_Onboard_Graphics_Notebooks_Native_Resolution" +} + +function xorg_restore +{ + is_root || return + + echo "Are you sure? This will replace your /etc/X11/xorg.conf and /etc/X11/xorg.conf.d/*.conf." + echo "[Y/n]" + local reply + read reply + if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then + echo "OK, aborting." + return + fi + + if [[ -f /etc/X11/xorg.conf.BKUP ]]; then + echo "xorg.conf backup (/etc/X11/xorg.conf.BKUP) exists, whew!" + cp /etc/X11/xorg.conf.BKUP /etc/X11/xorg.conf + echo "" + echo "The original xorg.conf has been restored" + else + echo "UH OH!! The backup /etc/X11/xorg.conf.BKUP hasn't been made." + echo "If you think you need the file, don't panic, you can copy it from the Live DVD/CD." + fi + + echo "" + + if [[ -d /etc/X11/xorg.conf.d.BKUP ]] \ + && (shopt -s nullglob; f=(/etc/X11/xorg.conf.d.BKUP/*.conf); [[ ${#f[*]} -ne 0 ]] ) + then + echo "The backup /etc/X11/xorg.conf.d.BKUP (directory) exists and contails .conf files." + mkdir -p /etc/X11/xorg.conf.d + # similar notes as for xorg_backup, but files like .disabled are not removed + rm -f /etc/X11/xorg.conf.d/*.conf + cp /etc/X11/xorg.conf.d.BKUP/* /etc/X11/xorg.conf.d/ + echo "Your settings are now restored to /etc/X11/xorg.conf.d/." + fi +} + +function grub_backup +{ + is_root || return + + echo "Note: to modify GRUB configuration, you should edit /etc/default/grub" + echo " or a file in /etc/grub.d and then run grub-mkconfig -o /boot/grub/grub.cfg" + echo " (/boot/grub/grub.cfg shouldn't be edited by hand)." + echo "" + + if [[ -f /boot/grub/grub.cfg.BKUP ]]; then + echo "grub.cfg backup already exists, so the new one wasn't made." + echo "Now off we go to edit the file...." + else + echo "Making backup of grub.cfg as /boot/grub/grub.cfg.BKUP" + cp /boot/grub/grub.cfg /boot/grub/grub.cfg.BKUP + echo "" + fi +} + +function grub_restore +{ + is_root || return + + echo "Are you sure? This will replace your /boot/grub/grub.cfg." + echo "[Y/n]" + local reply + read reply + if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then + echo "OK, aborting." + return + fi + + if [[ -f /boot/grub/grub.cfg.BKUP ]] + then + echo "grub.cfg backup (/boot/grub/grub.cfg.BKUP) exists, whew!" + cp /boot/grub/grub.cfg.BKUP /boot/grub/grub.cfg + echo "" + echo "The original grub.cfg has been restored" + else + echo "UH OH!! The backup script /boot/grub/grub.cfg.BKUP hasn't been made." + echo "Don't panic, you can use the Sabayon installer to repair GRUB." + fi +} + +function horner +{ + +# Quick system info gatherer written for Sabayon GNU/Linux +#(http://sabayonlinux.org) +# Copyright 2008 Richard Edward Horner +# Last modified 2008-11-26 +# Please send all comments, suggestions, bugs and patches to (rich AT +#richhorner DOT com) + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +HOSTNAME=`hostname` +RELEASE=`cat /etc/sabayon-release` +CPU=`uname -p` +KERNEL=`uname -r` +KERN_ARCH=`uname -m` +DISK=`df -lT --exclude-type=tmpfs --exclude-type=rootfs | awk 'BEGIN { total = 0; used = 0 } { if (NR > 1) { total += $3; used += $4 } } END { printf "%.1f/%.1fGB", used / 1000000, total / 1000000 }'` +MEMORY=`cat /proc/meminfo | awk '{ if ($1 == "MemTotal:") { memtot = $2/1000 } else if ($1 == "MemFree:") { memfree = $2/1000 } } END { printf "%d/%dM", memfree, memtot }'` +DAYS=`cat /proc/uptime | awk '{ printf "%.1f", $1/86400 }'` +PROCS=`ps aux | awk 'END { print NR - 2 }'` +RENDERER=`glxinfo | awk -F : '{ if ($1 == "OpenGL renderer string") print $2 }'` + +echo "Sysinfo for '$HOSTNAME': $RELEASE with $KERN_ARCH kernel $KERNEL +on $CPU, HD: $DISK, MEM: $MEMORY, Renderer: $RENDERER, $PROCS procs, +up $DAYS days" + +} + +# echo -e "\a[pastebunz debug ON]" >&2; +# function pastebunz { sed 's/^/[pb] '/ | less; } + +# pastebunz seems to have some limit on max pasted lines, so this would be handy... +function files_pastebin_linelimit +{ + # args: limit file_to_pastebin [file_to_pastebin] ... + # example: file_pastebin_linelimit 30 file1 "file name2" file3 + # first arg: 0 means no limit + # By Enlik + local TMPFILE=~/newbietmp + local LINESLIMIT + local LLIMIT_H + + if [[ $# -le 1 ]]; then + echo "Error: no files to paste (in files_pastebin_linelimit)." >&2 + return 2 + fi + + let LINESLIMIT=$1 + shift + # If there is a limit of lines, we need to make space for file name and blank + # lines to be pasted. Otherwise we have as much space as we want. + if [[ $LINESLIMIT -eq 0 ]]; then + LLIMIT_H="+1" + else + LLIMIT_H=$(( LINESLIMIT - 3 )) + fi + + >"$TMPFILE" || { + echo "Oh no! I can't create temporary file... Aborting." >&2 + return 3 + } + + for file in "$@"; do + echo " --- file: $file ---" + echo " " + if [[ -r $file ]]; then + # This tail guarantees that LAST file name is visible (unless the limit is really small, <= 2 lines) + # (previous one(s) can be wiped by tail due to limit of lines). + # The file name is always visible if there's only one specified + # as argument (unless the limit value is really small, as above). + # All file names are always visible if there's no limit + # of lines, or the limit is big enough. + cat "$file" 2>&1 | tail -n $LLIMIT_H + elif [[ -e $file ]]; then + echo "THIS FILE COULDN'T BE READ." + else + echo "THIS FILE DOESN'T EXIST." + fi + echo " " + done >> "$TMPFILE" + if [[ $LINESLIMIT -eq 0 ]]; then + cat "$TMPFILE" | pastebunz + else + tail -n $LINESLIMIT "$TMPFILE" | pastebunz + fi + echo "** Please see the link above! **" + + rm "$TMPFILE" + return 0 +} + +function files_pastebin +{ + files_pastebin_linelimit 0 "$@" +} + +function system_pastebin +{ + echo -n "Please wait, it is going to take a while..." + local PASTE_TMP=/tmp/sabutil-tmp + + >"$PASTE_TMP" || { + echo "Oh no! I can't create temporary file... Aborting." + return 1 + } + + echo " + sh /sbin/logscript.sh + " >> "$PASTE_TMP" + sh "/sbin/logscript.sh" >> "$PASTE_TMP" + + cat "$PASTE_TMP" + cat "$PASTE_TMP" | pastebunz + echo "*** Please see the link above. ***" + rm "$PASTE_TMP" +} + +function xorg0log_pastebin +{ + tail -n 150 /var/log/Xorg.0.log + files_pastebin_linelimit 150 /var/log/Xorg.0.log +} + +function xsessionerrors_pastebin +{ + cat "$HOMEDIR/.xsession-errors" | tail -n 10 + files_pastebin_linelimit 150 "$HOMEDIR/.xsession-errors" + if [[ $USER = "root" ]]; then + echo + echo "Notice: root's .xsession-errors file has been pasted." + echo "To get .xsession-errors from your regular account on which" + echo "you are logged using GDM, KDM or so (which is probably what you want)," + echo "run this script as that user, not root, or pastebin .xsession-errors" + echo "from YOUR home directory manually." + echo + fi +} + +function dmesg_pastebin +{ + cat /var/log/dmesg + files_pastebin_linelimit 150 /var/log/dmesg +} + +function grub_pastebin +{ + cat /boot/grub/grub.cfg + files_pastebin /boot/grub/grub.cfg +} + +function fdisk_pastebin +{ + is_root || return # fdisk -l + + local PASTE_TMP=/tmp/sabutil-tmp + + >"$PASTE_TMP" || { + echo "Oh no! I can't create temporary file... Aborting." + return 1 + } + + ( + echo " + fdisk -l + "; + fdisk -l; + ) > "$PASTE_TMP" + + cat "$PASTE_TMP" + cat "$PASTE_TMP" | pastebunz + echo "*** Please see the link above. ***" + rm "$PASTE_TMP" +} + +function messages_pastebin +{ + tail -n 150 /var/log/messages + files_pastebin_linelimit 150 /var/log/messages +} + +function kdm_pastebin +{ + cat /var/log/kdm.log + files_pastebin_linelimit 150 /var/log/kdm.log +} + +function rclog_pastebin +{ + if [[ -f /var/log/rc.log ]]; then + cat /var/log/rc.log | tail -n 10 + files_pastebin_linelimit 150 /var/log/rc.log + else + echo "You Don't Have rc.log enabled in your /etc/rc.log" + echo " To enable, edit /etc/rc.log change NO to YES for rc_logger= " + echo "" + fi +} + +function rcupdate_pastebin +{ + local PASTE_TMP=/tmp/sabutil-tmp + + >"$PASTE_TMP" || { + echo "Oh no! I can't create temporary file... Aborting." + return 1 + } + + ( + echo " + rc-update show + "; + rc-update show + ) > "$PASTE_TMP" + + cat "$PASTE_TMP" + cat "$PASTE_TMP" | pastebunz + echo "*** Please see the link above. ***" + rm "$PASTE_TMP" +} + +function xorg_pastebin +{ + echo "These files will be pasted (don't worry if any of them don't exist):" + ls -l /etc/X11/xorg.conf /etc/X11/xorg.conf.d/* + files_pastebin /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf +} + +function xorg_edit +{ + is_root &> /dev/null || echo "You are not root. You will only be able to view files." + + local xorgfiles=() file + if (shopt -s nullglob; f=(/etc/X11/xorg.conf.d/*.conf); [[ ${#f[*]} -ne 0 ]] ); then + xorgfiles=( /etc/X11/xorg.conf.d/* ) # let's put all non-dot files; warning for non-conf is below + fi + + if [[ -f /etc/X11/xorg.conf ]]; then + xorgfiles+=( /etc/X11/xorg.conf ) + fi + + if [[ ${#xorgfiles[*]} -eq 0 ]]; then + echo "I can't find any Xorg configuration files." + echo "There's no /etc/X11/xorg.conf or .conf files in /etc/X11/xorg.conf.d/ directory." + echo "Xorg uses autodected settings." + else + echo "These files affect your Xorg configuration." + echo "See http://fedoraproject.org/wiki/Input_device_configuration#xorg.conf.d for more informations." + echo "Select a file to edit or type q and press Enter to quit." + select file in "${xorgfiles[@]}"; do + if [[ -n $file ]]; then + # Not sure about files that don't start with a number and a hyphen - are they used? + if [[ ${file##*.} != "conf" ]]; then + echo "Warning: this file has no .conf suffix and thus will be ignored by Xorg." + press_enter + fi + nano -w "$file" + echo "Select a file to edit or type q and press Enter to quit." + elif [[ $REPLY = "q" || $REPLY = "Q" ]]; then + break + fi + done + fi +} + +clear + +if [[ $1 = "menu" ]]; then + if [[ $EUID -ne 0 ]]; then + echo "This script should be run as root, or by someone in the root group. Some commands will not work for you." 1>&2 + echo "" + fi + menu +elif [[ $1 = "--help" || $1 = "-h" ]]; then + echo "usage:" + echo "$0 - will print some basic system infos" + echo "$0 menu - will show you menu" +else + horner + echo "" + echo "Specify --help or -h to get help." + fi diff --git a/app-misc/rogentoslive-tools/files/1.0/vga-cmd-parser b/app-misc/rogentoslive-tools/files/1.0/vga-cmd-parser new file mode 100644 index 00000000..1e443171 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/vga-cmd-parser @@ -0,0 +1,53 @@ +#!/usr/bin/python +# Copyright 2008 Fabio Erculiani, Sabayon Linux Chief Architect +# parses vga= parameters from cmdline given by isolinux and returns the right resolution +# Shut up! + +res_map = { + "0x385": ("640x400",24), + "0x312": ("640x480",24), + "0x315": ("800x600",24), + "0x318": ("1024x768",24), + "0x31b": ("1280x1024",24), + "0x330": ("640x400",16), + "0x33E": ("640x400",24), + "0x331": ("640x480",16), + "0x33F": ("640x480",24), + "0x332": ("800x600",16), + "0x340": ("800x600",24), + "0x333": ("1024x768",16), + "0x341": ("1024x768",24), + "0x334": ("1152x864",16), + "0x342": ("1152x864",24), + "0x335": ("1280x960",16), + "0x343": ("1280x960",24), + "0x336": ("1280x1024",16), + "0x344": ("1280x1024",24), + "0x337": ("1400x1050",16), + "0x345": ("1400x1050",24), + "0x338": ("1600x1200",16), + "0x346": ("1600x1200",24), + "0x339": ("1792x1344",16), + "0x347": ("1792x1344",24), + "0x33A": ("1856x1392",16), + "0x348": ("1856x1392",24), + "0x33B": ("1920x1440",16), + "0x349": ("1920x1440",24), + "0x33C": ("2048x1536",16), + "0x34A": ("2048x1536",24) +} + +f = open("/proc/cmdline") +cmdline = f.readline().strip().split() +cmdline.reverse() +for item in cmdline: + if item.startswith("vga="): + item_split = item.split("=") + if len(item_split) == 2: + data = item_split[1] + try: + if res_map.get(data) != None: + print res_map[data][0],res_map[data][1] + break + except TypeError: + pass diff --git a/app-misc/rogentoslive-tools/files/1.0/x-setup-configuration b/app-misc/rogentoslive-tools/files/1.0/x-setup-configuration new file mode 100644 index 00000000..57f1688f --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/x-setup-configuration @@ -0,0 +1,60 @@ +#!/bin/bash + +# get livecd functions +source /sbin/livecd-functions.sh +source /sbin/rogentos-functions.sh + +runtime_linking_proprietary_drivers() { + if [ -d "/lib/nvidia" ] || [ -d "/lib/fglrx" ]; then + 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 + depmod -a &> /dev/null + 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 + depmod -a &> /dev/null + 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 + depmod -a &> /dev/null + 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 + depmod -a &> /dev/null + fi + fi +} + +buggy_fglrx_xv_fixup_code() { + # This is a workaround for xv being broken + # on fglrx <12.2, disable Xv in xorg.conf.d + local workaround_file=/usr/share/rogentoslive-tools/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf + if [ -f "${workaround_file}" ]; then + is_fglrx=$(/bin/lsmod | grep ^fglrx) + if [ -n "${is_fglrx}" ]; then + cp "${workaround_file}" /usr/share/X11/xorg.conf.d + fi + fi +} + +# create seed +rm -f /etc/x-setup-configuration-running +touch /etc/x-setup-configuration-running + +# Prepare Video Cards Proprietary Drivers +if sabayon_is_live; then + runtime_linking_proprietary_drivers +fi +/sbin/gpu-configuration &> /dev/null + +# buggy_fglrx_xv_fixup_code + +# delete seed +rm -f /etc/x-setup-configuration-running diff --git a/app-misc/rogentoslive-tools/files/1.0/x-setup-init.d b/app-misc/rogentoslive-tools/files/1.0/x-setup-init.d new file mode 100755 index 00000000..5b94ec94 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/x-setup-init.d @@ -0,0 +1,68 @@ +#!/sbin/runscript +# Copyright 2009-2012 Fabio Erculiani - Sabayon Linux +# Distributed under the terms of the GNU General Public License v2 + +depend() { + after mtab + before hostname + before xdm +} + +gpus_same() { + # $1 and $2: output lines from "lspci" + local id1 id2 # [xxxx:]xx:xx.x + local dev1 dev2 # vendor and device: xxxx:xxxx + id1=$(echo "$1" | awk '/ VGA / { print $1 }') + id2=$(echo "$2" | awk '/ VGA / { print $1 }') + if [ -z "$id1" ] || [ -z "$id2" ]; then + return 1 + fi + dev1=$(lspci -s "$id1" -n | awk '{ print $3 }') + dev2=$(lspci -s "$id2" -n | awk '{ print $3 }') + [ "$dev1" = "$dev2" ] +} + +start() { + . /sbin/rogentos-functions.sh + local do_redetect + do_redetect=$(cat /proc/cmdline | grep "gpudetect") + + if sabayon_is_live; then + ebegin "Configuring GPU Hardware Acceleration and Input devices" + start-stop-daemon --start --background --pidfile /var/run/x-setup.pid --make-pidfile --exec /usr/sbin/x-setup-configuration + eend 0 + else + if [ -e /first_time_run ] || [ ! -e /etc/gpu-detector.conf ] \ + || [ -n "$do_redetect" ] || [ ! -f /etc/X11/xorg.conf ]; then + ebegin "Configuring GPU Hardware Acceleration and Input devices for the first time" + # store config file + lspci | grep ' VGA ' > /etc/gpu-detector.conf + /usr/sbin/x-setup-configuration + eend 0 + return + fi + + local lspci_vga stored_vga + local infostr_run="Configuring GPU Hardware Acceleration and Input devices" + local infostr_skip="Skipping GPU Hardware Acceleration and Input devices configuration" + lspci_vga=$(lspci | grep ' VGA ') + stored_vga=$(cat /etc/gpu-detector.conf) + + if [ "$lspci_vga" != "$stored_vga" ] ; then + # Strings are different, let's do the more "heavy" and accurate comparison. + if gpus_same "$lspci_vga" "$stored_vga"; then + # this may happen after vendor changes its name etc. and PCI ID file is updated + ebegin "${infostr_skip}, only updating GPU information file" + else + ebegin "$infostr_run" + /usr/sbin/x-setup-configuration &> /dev/null + fi + + echo "$lspci_vga" > /etc/gpu-detector.conf + eend 0 + return + fi + + einfo "$infostr_skip" + fi +} diff --git a/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf new file mode 100644 index 00000000..54478aa9 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf @@ -0,0 +1,4 @@ +Section "Extensions" + # This should be hopefully fixed in ati-drivers-12.2 + Option "XVideo" "Disable" +EndSection diff --git a/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-synaptics.conf b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-synaptics.conf new file mode 100644 index 00000000..245b2458 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-synaptics.conf @@ -0,0 +1,58 @@ +Section "InputClass" + Identifier "touchpad catchall" + Driver "synaptics" + MatchIsTouchpad "on" + MatchDevicePath "/dev/input/event*" + + # No longer needed, see bug 1922#12 + # Option "SHMConfig" "1" + # More harm than good? see bug 1922#12 + # Option "MaxTapMove" "2000" + Option "VertEdgeScroll" "1" + Option "VertTwoFingerScroll" "1" + Option "HorizTwoFingerScroll" "1" + Option "CircularScrolling" "0" + Option "TapButton1" "1" + Option "TapButton2" "2" + Option "TapButton3" "3" + +EndSection + +# Apple MacBook Touchpad +Section "InputClass" + Identifier "touchpad catchall" + Driver "synaptics" + MatchIsTouchpad "on" + MatchDevicePath "/dev/input/event*" + MatchProduct "bcm5974" + Option "ClickFinger1" "1" + Option "ClickFinger2" "3" + Option "ClickFinger3" "2" + Option "HorizEdgeScroll" "0" + Option "VertEdgeScroll" "0" + Option "VertEdgeScroll" "1" + Option "VertTwoFingerScroll" "1" + Option "HorizTwoFingerScroll" "1" + Option "HorizScrollDelta" "0" + Option "VertScrollDelta" "40" + Option "PressureMotionMinZ" "10" + Option "FingerLow" "16" + Option "FingerHigh" "80" + Option "FingerPress" "256" + Option "PalmDetect" "1" + Option "PalmMinWidth" "10" + Option "PalmMinZ" "200" + Option "MinSpeed" "0.8" + Option "MaxSpeed" "1.2" + Option "AccelFactor" "0.10" + Option "MaxTapMove" "25" + Option "MaxTapTime" "223" + Option "MaxDoubleTapTime" "200" + Option "TapButton1" "0" + Option "TapButton2" "0" + Option "TapButton3" "0" + Option "RTCornerButton" "0" + Option "RBCornerButton" "0" + Option "LTCornerButton" "0" + Option "LBCornerButton" "0" +EndSection diff --git a/app-misc/rogentoslive-tools/files/1.0/xorg.conf.rogentos b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.rogentos new file mode 100644 index 00000000..bc6135c3 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.rogentos @@ -0,0 +1,100 @@ +Section "Module" + SubSection "extmod" + Option "omit xfree86-dga" + EndSubSection + Load "i2c" + Load "ddc" + Load "vbe" +# Load "dri" +EndSection + + +Section "ServerFlags" + Option "AllowMouseOpenFail" "true" +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" + Option "UseEvents" "True" +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 + + SubSection "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" + +EndSection + +Section "DRI" + Mode 0666 +EndSection + +Section "Extensions" + #Option "Composite" "Enable" +EndSection + diff --git a/app-misc/rogentoslive-tools/files/2/bashlogin b/app-misc/rogentoslive-tools/files/2/bashlogin new file mode 100644 index 00000000..34689189 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/bashlogin @@ -0,0 +1,6 @@ +#!/bin/bash + +cat /etc/motd 2>/dev/null +cd /root +[[ -e .bash_profile ]] && source .bash_profile +exec -l /bin/bash -i diff --git a/app-misc/rogentoslive-tools/files/2/cdeject b/app-misc/rogentoslive-tools/files/2/cdeject new file mode 100644 index 00000000..302a3415 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/cdeject @@ -0,0 +1,11 @@ +#!/sbin/runscript + +description="Eject LiveCD/DVD at live system shutdown/reboot" + +depend() { + after * +} + +start() { + /usr/libexec/cdeject.sh +} diff --git a/app-misc/rogentoslive-tools/files/2/cdeject.service b/app-misc/rogentoslive-tools/files/2/cdeject.service new file mode 100644 index 00000000..96f44242 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/cdeject.service @@ -0,0 +1,13 @@ +[Unit] +Description=Eject CD/DVD before power off or reboot +DefaultDependencies=no +After=shutdown.target +Before=final.target + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStart=/usr/libexec/cdeject.sh + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/app-misc/rogentoslive-tools/files/2/cdeject.sh b/app-misc/rogentoslive-tools/files/2/cdeject.sh new file mode 100644 index 00000000..ae75ae84 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/cdeject.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +is_live=$(cat /proc/cmdline | grep cdroot) + +if [ -n "${is_live}" ]; then + cdrom_dev=$(cat /proc/mounts | grep " /mnt/cdrom " | cut -d" " -f 1) + # check if /mnt/cdrom device is a cdrom device + if [ "${cdrom_dev}" = /dev/sr* ] || [ "${cdrom_dev}" = /dev/cdrom* ]; then + eject -mp "${cdrom_dev}" &> /dev/null + fi +fi + diff --git a/app-misc/rogentoslive-tools/files/2/installer-gui b/app-misc/rogentoslive-tools/files/2/installer-gui new file mode 100644 index 00000000..5300726d --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/installer-gui @@ -0,0 +1,15 @@ +#!/sbin/runscript +# Copyright 2004-2013 Sabayon +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before xdm + after rogentoslive + need dbus +} + +start() { + ebegin "Configuring the installer" + /usr/libexec/installer-gui.sh + eend $? +} diff --git a/app-misc/rogentoslive-tools/files/2/installer-gui.service b/app-misc/rogentoslive-tools/files/2/installer-gui.service new file mode 100644 index 00000000..963245ca --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/installer-gui.service @@ -0,0 +1,12 @@ +[Unit] +Description=Sabayon installer setup +Before=display-manager.service +After=rogentoslive.service + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStart=/usr/libexec/installer-gui.sh + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/app-misc/rogentoslive-tools/files/2/installer-gui.sh b/app-misc/rogentoslive-tools/files/2/installer-gui.sh new file mode 100644 index 00000000..7636678d --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/installer-gui.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. /sbin/rogentos-functions.sh + +if rogentos_is_gui_install; then + rogentos_setup_autologin + rogentos_setup_gui_installer +fi diff --git a/app-misc/rogentoslive-tools/files/2/installer-text b/app-misc/rogentoslive-tools/files/2/installer-text new file mode 100644 index 00000000..faada208 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/installer-text @@ -0,0 +1,13 @@ +#!/sbin/runscript +# Copyright 2004-2013 Sabayon Linux +# Distributed under the terms of the GNU General Public License v2 + +depend() { + after * +} + +start() { + ebegin "Configuring the text installer" + /usr/libexec/installer-text.sh + eend $? +} diff --git a/app-misc/rogentoslive-tools/files/2/installer-text.service b/app-misc/rogentoslive-tools/files/2/installer-text.service new file mode 100644 index 00000000..be11d2b7 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/installer-text.service @@ -0,0 +1,11 @@ +[Unit] +Description=Sabayon text installer setup +After=rogentoslive.service + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStart=/usr/libexec/installer-text.sh + +[Install] +WantedBy=multi-user.target diff --git a/app-misc/rogentoslive-tools/files/2/installer-text.sh b/app-misc/rogentoslive-tools/files/2/installer-text.sh new file mode 100644 index 00000000..8bb1262b --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/installer-text.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +. /sbin/rogentos-functions.sh + +if rogentos_is_text_install; then + rogentos_setup_text_installer +fi diff --git a/app-misc/rogentoslive-tools/files/2/livecd-functions.sh b/app-misc/rogentoslive-tools/files/2/livecd-functions.sh new file mode 100644 index 00000000..5e0c4600 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/livecd-functions.sh @@ -0,0 +1,635 @@ +#!/bin/bash + +# Global Variables: +# CDBOOT -- is booting off CD +# LIVECD_CONSOLE -- console that is specified on commandline +# -- (ttyS0, 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" ]] && \ + [[ -e /etc/init.d/functions.sh ]] && \ + source /etc/init.d/functions.sh + +# emulating einfo since it's not always available from functions.sh +# FIXME: fix functions.sh +einfo() { + [[ -x "/lib/rc/bin/einfo" ]] && /lib/rc/bin/einfo "${1}"\ + || echo "* ${1}" +} + +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 + 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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${iface}.SSID) + if [ -n "${SSID}" ] + then + echo "" >> /etc/conf.d/net + echo "# This wireless configuration file was built by net-setup" > /etc/conf.d/net + WEP=$(tail -n 1 ${iface}.WEPTYPE) + case ${WEP} in + 1) + WEP_TYPE=$(tail -n 1 ${iface}.WEPTYPE) + if [ -n "${WEP_TYPE}" ] + then + WEP_KEY=$(tail -n 1 ${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/net + ;; + 2) + echo "key_${SSID_TRANS}=\"s:${WEP_KEY} enc open\"" >> /etc/conf.d/net + ;; + esac + fi + fi + ;; + 2) + : + ;; + esac + echo "preferred_aps=( \"${SSID}\" )" >> /etc/conf.d/net + echo "associate_order=\"forcepreferredonly\"" >> /etc/conf.d/net + 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=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${iface}.BC) + dialog --title "Network mask" --inputbox "Please enter a Network Mask for ${iface}:" 20 50 "255.255.255.0" 2> ${iface}.NM + NETMASK=$(tail -n 1 ${iface}.NM) + dialog --title "Gateway" --inputbox "Please enter a Gateway for ${iface} (hit enter for none:)" 20 50 2> ${iface}.GW + GATEWAY=$(tail -n 1 ${iface}.GW) + dialog --title "DNS server" --inputbox "Please enter a name server to use (hit enter for none:)" 20 50 2> ${iface}.DNS + DNS=$(tail -n 1 ${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=$(tail -n 1 ${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=$(tail -n 1 ${iface}.DHCP) + case ${DHCP} in + 1) + echo "config_${iface}=\"dhcp\"" >> /etc/conf.d/net + echo "dhcp_${iface}=\"nosendhost\"" >> /etc/conf.d/net + ;; + 2) + IP=$(tail -n 1 ${iface}.IP) + BROADCAST=$(tail -n 1 ${iface}.BC) + NETMASK=$(tail -n 1 ${iface}.NM) + GATEWAY=$(tail -n 1 ${iface}.GW) + DNS="$(tail -n 1 ${iface}.DNS)" + DOMAIN="$(tail -n 1 ${iface}.SUFFIX)" + if [ -n "${IP}" -a -n "${BROADCAST}" -a -n "${NETMASK}" ] + then + echo "config_${iface}=\"${IP} netmask ${NETMASK} broadcast ${BROADCAST}\"" >> /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} +} + +livecd_rev_string() { + # See Sabayon #2522, cannot use /usr/bin/rev because + # /usr might not be mounted + local copy=${1} + len=${#copy} + for((i=$len-1;i>=0;i--)); do rev="$rev${copy:$i:1}"; done + echo ${rev} +} + +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}" + + eval dialog --menu \"Please select the interface that you wish to configure from the list below:\" 0 0 0 $opts 2>iface + [[ "$?" == "1" ]] && exit + + 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=$(livecd_rev_string $1 | 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=$(livecd_rev_string $1 | 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" + RC_NO_UMOUNTS="^(/|/dev|/dev/pts|/lib/rcscripts/init.d|/proc|/proc/.*|/sys|/mnt/livecd|/newroot)$" + export CDBOOT RC_NO_UMOUNTS + ;; + cdroot\=*) + CDBOOT="yes" + RC_NO_UMOUNTS="^(/|/dev|/dev/pts|/lib/rcscripts/init.d|/proc|/proc/.*|/sys|/mnt/livecd|/newroot)$" + export CDBOOT RC_NO_UMOUNTS + ;; + 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 + 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 + 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 +} diff --git a/app-misc/rogentoslive-tools/files/2/livespawn b/app-misc/rogentoslive-tools/files/2/livespawn new file mode 100644 index 00000000..44d7257e --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/livespawn @@ -0,0 +1,10 @@ +#!/usr/bin/python +import sys, os, subprocess +args = sys.argv[1:] +if not args: raise SystemExit(1) + +pid = os.fork() +if pid == 0: + p = subprocess.Popen(args) + rc = p.wait() + raise SystemExit(rc) diff --git a/app-misc/rogentoslive-tools/files/2/logscript.sh b/app-misc/rogentoslive-tools/files/2/logscript.sh new file mode 100644 index 00000000..78381915 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/logscript.sh @@ -0,0 +1,111 @@ +#!/bin/sh +#requires the following +# free, hostname, grep, cut, awk, uname + +HOSTNAME=`hostname -s` +IP_ADDRS=`ifconfig | grep 'inet addr' | grep -v '255.0.0.0' | cut -f2 -d':' | awk '{print $1}'` +IP_ADDRS=`echo $IP_ADDRS | sed 's/\n//g'` + +#memory +MEMORY=`free | grep Mem | awk '{print $2}'` + +#cpu info +CPUS=`cat /proc/cpuinfo | grep processor | wc -l | awk '{print $1}'` +CPU_MHZ=`cat /proc/cpuinfo | grep MHz | tail -n1 | awk '{print $4}'` +CPU_TYPE=`cat /proc/cpuinfo | grep vendor_id | tail -n 1 | awk '{print $3}'` +CPU_TYPE2=`uname -m` +CPU_TYPE3=`uname -p` + +OS_NAME=`uname -s` +OS_OS=`uname -o` +OS_KERNEL=`uname -r` +OS_RELEASE=`cat /etc/rogentos-release` +OS_EDITION=`cat /etc/rogentos-edition` +ESELECT_KERNEL=`eselect --no-color kernel list` +ESELECT_OPENGL=`eselect --no-color opengl list` +ESELECT_JAVA=`eselect --no-color java-vm list` +ESELECT_JAVAP=`eselect --no-color java-nsplugin list` + +EQUO=`equo --version` +PORTAGE=`emerge --version` + +UPTIME=`uptime` +MEM=`free -t -m` +SPACE=`df -TH` + +PCIINFO=`lspci | cut -f3 -d':'` +#Another way to do it +#PCIINFO=`lspci | cut -f3 -d':'` + +LSUSB=`lsusb` +LSMOD=`lsmod` +#print it out +echo "$HOSTNAME" +echo "--------------------------------------------------------------------" +echo "Hostname : $HOSTNAME" +echo "Host Address : $IP_ADDRS" +echo "Main Memory : $MEMORY" +echo "Number of CPUs : $CPUS" +echo "CPU Type : $CPU_TYPE2 $CPU_TYPE3 $CPU_MHZ MHz" +echo "OS Release : $OS_RELEASE" +echo "OS Edition : $OS_EDITION" +echo "Kernel Name : $OS_NAME $OS_OS" +echo "Kernel Version : $OS_KERNEL" +echo "Uptime : $UPTIME" +echo "--------------------------------------------------------------------" +echo +echo "Entropy Version" +echo "$EQUO" +echo +echo "Portage Version" +echo "$PORTAGE" +echo "--------------------------------------------------------------------" +echo +echo "Kernel List" +echo "$ESELECT_KERNEL" +echo "Your Kernel Should Be Set To:" +echo "$OS_KERNEL" +echo "Use eselect kernel set #" +echo "--------------------------------------------------------------------" +echo +echo "OpenGL List" +echo "$ESELECT_OPENGL" +echo "The above should be set to your video card, see lspci" +echo "Use eselect opengl set #" +echo "--------------------------------------------------------------------" +echo +echo "Java VM List" +echo "$ESELECT_JAVA" +echo "Use java-config --set-system-vm #" +echo "--------------------------------------------------------------------" +echo +echo "Java-nsplugin List" +echo "$ESELECT_JAVAP" +echo "Use eselect java-nsplugin set #" +echo "--------------------------------------------------------------------" +echo +echo "Devices - lspci" +echo "--------------------------------------------------------------------" +echo "$PCIINFO" +echo "--------------------------------------------------------------------" +echo +echo "Devices - lsmod" +echo "--------------------------------------------------------------------" +echo "$LSMOD" +echo "--------------------------------------------------------------------" +echo +echo "Devices - lsusb" +echo "--------------------------------------------------------------------" +echo "$LSUSB" +echo "--------------------------------------------------------------------" +echo +echo "Memory" +echo "--------------------------------------------------------------------" +echo "$MEM" +echo "--------------------------------------------------------------------" +echo +echo "Disk Space" +echo "--------------------------------------------------------------------" +echo "$SPACE" +echo "--------------------------------------------------------------------" +echo diff --git a/app-misc/rogentoslive-tools/files/2/net-setup b/app-misc/rogentoslive-tools/files/2/net-setup new file mode 100644 index 00000000..e84de48b --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/net-setup @@ -0,0 +1,65 @@ +#!/bin/bash +# Copyright 1999-2005 Gentoo Foundation +# Copyright 2006-2008 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=$(tail -n 1 ${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 diff --git a/app-misc/rogentoslive-tools/files/2/rogentos-functions.sh b/app-misc/rogentoslive-tools/files/2/rogentos-functions.sh new file mode 100644 index 00000000..d5584715 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/rogentos-functions.sh @@ -0,0 +1,284 @@ +#!/bin/bash + +GDM_FILE="/usr/share/gdm/defaults.conf" +CUSTOM_GDM_FILE="/etc/gdm/custom.conf" +KDM_FILE="/usr/share/config/kdm/kdmrc" +LXDM_FILE="/etc/lxdm/lxdm.conf" +LIGHTDM_FILE="/etc/lightdm/lightdm.conf" +OEM_FILE="/etc/oemlive.sh" +OEM_FILE_NEW="/etc/oem/liveboot.sh" +LIVE_USER_GROUPS="audio bumblebee cdrom cdrw clamav console entropy games \ +kvm lp lpadmin messagebus plugdev polkituser portage pulse pulse-access pulse-rt \ +scanner usb users uucp vboxguest vboxusers video wheel" +LIVE_USER=${ROGENTOS_USER:-rogentosuser} + +rogentos_setup_autologin() { + # GDM - GNOME + if [ -f "${GDM_FILE}" ]; then + sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=true/" ${GDM_FILE} + sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${LIVE_USER}/" ${GDM_FILE} + + sed -i "s/^TimedLoginEnable=.*/TimedLoginEnable=true/" ${GDM_FILE} + sed -i "s/^TimedLogin=.*/TimedLogin=${LIVE_USER}/" ${GDM_FILE} + sed -i "s/^TimedLoginDelay=.*/TimedLoginDelay=0/" ${GDM_FILE} + + elif [ -f "${CUSTOM_GDM_FILE}" ]; then + # FIXME: if this is called multiple times, it generates duplicated entries + sed -i "s:\[daemon\]:\[daemon\]\nAutomaticLoginEnable=true\nAutomaticLogin=${LIVE_USER}\nTimedLoginEnable=true\nTimedLogin=${LIVE_USER}\nTimedLoginDelay=0:" \ + "${CUSTOM_GDM_FILE}" + # change other entries there + sed -i "s/^TimedLogin=.*/TimedLogin=${LIVE_USER}/" "${CUSTOM_GDM_FILE}" + sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${LIVE_USER}/" "${CUSTOM_GDM_FILE}" + fi + + # KDM - KDE + if [ -f "$KDM_FILE" ]; then + sed -i "s/AutoLoginEnable=.*/AutoLoginEnable=true/" $KDM_FILE + sed -i "s/AutoLoginUser=.*/AutoLoginUser=${LIVE_USER}/" $KDM_FILE + sed -i "s/AutoLoginDelay=.*/AutoLoginDelay=0/" $KDM_FILE + sed -i "s/AutoLoginAgain=.*/AutoLoginAgain=true/" $KDM_FILE + + sed -i "s/AllowRootLogin=.*/AllowRootLogin=true/" $KDM_FILE + sed -i "s/AllowNullPasswd=.*/AllowNullPasswd=true/" $KDM_FILE + sed -i "s/AllowShutdown=.*/AllowShutdown=All/" $KDM_FILE + + sed -i "/^#.*AutoLoginEnable=/ s/^#//" $KDM_FILE + sed -i "/^#.*AutoLoginUser=/ s/^#//" $KDM_FILE + sed -i "/^#.*AutoLoginDelay=/ s/^#//" $KDM_FILE + sed -i "/^#.*AutoLoginAgain=/ s/^#//" $KDM_FILE + + sed -i "/^#AllowRootLogin=/ s/^#//" $KDM_FILE + sed -i "/^#AllowNullPasswd=/ s/^#//" $KDM_FILE + sed -i "/^#AllowShutdown=/ s/^#//" $KDM_FILE + fi + + # LXDM + if [ -f "$LXDM_FILE" ]; then + sed -i "s/autologin=.*/autologin=${LIVE_USER}/" $LXDM_FILE + sed -i "/^#.*autologin=/ s/^#//" $LXDM_FILE + fi + + # LightDM + if [ -f "$LIGHTDM_FILE" ]; then + sed -i "s/autologin-user=.*/autologin-user=${LIVE_USER}/" $LIGHTDM_FILE + sed -i "/^#.*autologin-user=/ s/^#//" $LIGHTDM_FILE + fi + + # Setup correct login session + rogentos_is_normal_boot && rogentos_fixup_gnome_autologin_session +} + +rogentos_disable_autologin() { + # GDM - GNOME + if [ -f "${GDM_FILE}" ]; then + sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=false/" ${GDM_FILE} + fi + + # KDM - KDE + KDM_FILE="/usr/share/config/kdm/kdmrc" + if [ -f "$KDM_FILE" ]; then + sed -i "s/AutoLoginEnable=.*/AutoLoginEnable=false/" $KDM_FILE + fi + + # LXDM + if [ -f "$LXDM_FILE" ]; then + sed -i "s/^autologin=.*/autologin=/" $LXDM_FILE + fi + + # LightDM + if [ -f "$LIGHTDM_FILE" ]; then + sed -i "s/^autologin-user=.*/#autologin-user=/" $LIGHTDM_FILE + fi +} + +rogentos_setup_live_user() { + local live_user="${1}" + local live_uid="${2}" + if [ -z "${live_user}" ]; then + live_user="${LIVE_USER}" + fi + if [ -n "${live_uid}" ]; then + live_uid="-u ${live_uid}" + fi + id ${live_user} &> /dev/null + if [ "${?}" != "0" ]; then + local live_groups="" + local avail_groups=$(cat /etc/group | cut -d":" -f 1 | xargs echo) + for a_group in ${avail_groups}; do + for p_group in ${LIVE_USER_GROUPS}; do + if [ "${p_group}" = "${a_group}" ]; then + if [ -z "${live_groups}" ]; then + live_groups="${p_group}" + else + live_groups="${live_groups},${p_group}" + fi + fi + done + done + # then setup live user, that is missing + useradd -d "/home/${live_user}" -g root -G ${live_groups} -c "rogentosuser" \ + -m -N -p "" -s /bin/bash ${live_uid} "${live_user}" + return 0 + fi + return 1 +} + +rogentos_setup_motd() { + echo -e "\n\tWelcome to `cat /etc/rogentos-edition`\n\t`uname -p`\n\t`uname -o` `uname -r`\n" > /etc/motd +} + +rogentos_setup_vt_autologin() { + if openrc_running; then + . /sbin/livecd-functions.sh + export CDBOOT=1 + livecd_fix_inittab + elif systemd_running; then + cp /usr/lib/systemd/system/getty@.service \ + /etc/systemd/system/autologin@.service + sed -i "/^ExecStart=/ s:/sbin/agetty:/sbin/agetty --autologin root:g" \ + /usr/lib/systemd/system/getty@.service + sed -i "/^ExecStart=/ s:--noclear::g" \ + /usr/lib/systemd/system/getty@.service + systemctl daemon-reload + systemctl restart getty@tty1 + fi +} + +rogentos_setup_oem_livecd() { + if [ -x "${OEM_LIVE_NEW}" ]; then + ${OEM_FILE_NEW} || return 1 + elif [ -x "${OEM_LIVE}" ]; then + ${OEM_FILE} || return 1 + fi + return 0 +} + +rogentos_is_live() { + local cmdl=$(cat /proc/cmdline | grep cdroot) + if [ -n "${cmdl}" ]; then + return 0 + else + return 1 + fi +} + +rogentos_setup_gui_installer() { + # Configure Fluxbox + local dmrc_file="/home/${LIVE_USER}/.dmrc" + local flux_dir="/home/${LIVE_USER}/.fluxbox" + local flux_startup_file="${flux_dir}/startup" + if [ ! -d "${flux_dir}" ]; then + mkdir "${flux_dir}" && chown "${LIVE_USER}" "${flux_dir}" + fi + echo "[Desktop]" > "${dmrc_file}" + echo "Session=fluxbox" >> "${dmrc_file}" + chown rogentosuser "${dmrc_file}" + sed -i "/installer --fullscreen/ s/^# //" "${flux_startup_file}" + if [ -x "/usr/libexec/gdm-set-default-session" ]; then + # oh my fucking glorious god, this + # is AccountsService bullshit + # cross fingers + /usr/libexec/gdm-set-default-session fluxbox + fi + if [ -x "/usr/libexec/gdm-set-session" ]; then + # GDM 3.6 support + /usr/libexec/gdm-set-session rogentosuser fluxbox + fi +} + +# This function reads /etc/skel/.dmrc and properly +# set the Session= value inside AccountsService. +# Blame the idiots who broke de-facto standards +# and created this fugly thing called AccountsService +rogentos_fixup_gnome_autologin_session() { + local cur_session= + + if [ -f "/etc/skel/.dmrc" ]; then + cur_session=$(cat /etc/skel/.dmrc | grep ^Session | cut -d"=" -f 2) + fi + if [ -z "${cur_session}" ]; then + return 0 + fi + + local sess_file="/usr/share/xsessions/${cur_session}.desktop" + if [ ! -f "${sess_file}" ]; then + return 0 + fi + + if [ -x "/usr/libexec/gdm-set-default-session" ]; then + # this edits /etc/gdm/custom.conf adding [daemon]\nDefaultSession=${cur_session} + /usr/libexec/gdm-set-default-session "${cur_session}" + fi + + if [ -x "/usr/libexec/gdm-set-session" ]; then + # GDM 3.6 support + local users_in_users=$(cat /etc/group | grep "^users" | awk -F':' '{ print $4 }' | sed "s:,: :g") + for usr in ${users_in_users}; do + /usr/libexec/gdm-set-session "${usr}" "${cur_session}" + done + fi +} + +rogentos_setup_text_installer() { + if openrc_running; then + # switch to verbose mode + splash_manager -c set -t default -m v &> /dev/null + reset + chvt 1 + clear + fi + rogentos_setup_text_installer_motd +} + +rogentos_setup_text_installer_motd() { + echo "Welcome to RogentOS Linux Text installation." >> /etc/motd + echo "to run the installation type: installer " >> /etc/motd +} + +rogentos_is_text_install() { + local _is_install=$(cat /proc/cmdline | grep installer-text) + if [ -n "${_is_install}" ]; then + return 0 + else + return 1 + fi +} + +rogentos_is_gui_install() { + local _is_install=$(cat /proc/cmdline | grep installer-gui) + if [ -n "${_is_install}" ]; then + return 0 + else + return 1 + fi +} + +rogentos_is_live_install() { + ( rogentos_is_text_install || rogentos_is_gui_install ) && return 0 + return 1 +} + +rogentos_is_mce() { + local _is_mce=$(cat /proc/cmdline | grep sabayonmce) + if [ -n "${_is_mce}" ]; then + return 0 + else + return 1 + fi +} + +rogentos_is_normal_boot() { + if ! rogentos_is_mce && ! rogentos_is_live_install; then + return 0 + else + return 1 + fi +} + +systemd_running() { + test -d /run/systemd/system +} + +openrc_running() { + test -e /run/openrc/softlevel +} diff --git a/app-misc/rogentoslive-tools/files/2/rogentos-live-check b/app-misc/rogentoslive-tools/files/2/rogentos-live-check new file mode 100644 index 00000000..5ad3d509 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/rogentos-live-check @@ -0,0 +1,27 @@ +#!/bin/sh +# +# rogentos_livechk.sh +# +# Checks the integrity of a LiveCD/DVD by passing the +# contents of the image through a md5sum (to be compared +# with an documented value elsewhere). +# + +if ( ! isoinfo -d -i /dev/cdrom >>/dev/null 2>/dev/null ); then + echo "CDROM/DVD image not found!" + exit 1 +fi + +echo -e "Checking image integrity, please allow several minutes...\n" +echo "You can check for errors by running 'tail /var/log/messages'" +echo "in another console window. If you encounter multiple device" +echo "errors with you cdrom, this probably indicates the test is failing." +echo "You may type 'Ctrl-c' to abort the check." + +BLOCK_SIZE=`isoinfo -d -i /dev/cdrom | grep "Logical block size is" | cut -d: -f2 | sed 's/^[ ]//g'` +VOL_SIZE=`isoinfo -d -i /dev/cdrom | grep "Volume size is" | cut -d: -f2 | sed 's/^[ ]//g'` +dd if=/dev/cdrom bs=$BLOCK_SIZE count=$VOL_SIZE conv=notrunc,noerror | md5sum + +echo "Compare the above value with the value supplied in" +echo "the release notes for this version at:" +echo "http://www.rogentos.org/" diff --git a/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader b/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader new file mode 100644 index 00000000..8b0cf007 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader @@ -0,0 +1,10 @@ +#!/bin/sh + +SABAYON_LOADER="/usr/bin/xdg-open" +SABAYON_URL=${SABAYON_URL:-http://www.rogentos.org?install_welcome=1} + +# load Sabayon URL +[[ -x "${SABAYON_LOADER}" ]] && ${SABAYON_LOADER} ${SABAYON_URL} & + +# remove myself from autostart +rm ~/.config/autostart/rogentos-welcome-loader.desktop -f diff --git a/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader.desktop b/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader.desktop new file mode 100644 index 00000000..15679628 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=rogentos-loader +Exec=rogentos-welcome-loader +Icon=system-run +Comment=Sabayon Linux post-install Welcome Screen +Terminal=false diff --git a/app-misc/rogentoslive-tools/files/2/rogentoslive b/app-misc/rogentoslive-tools/files/2/rogentoslive new file mode 100644 index 00000000..ee1c5541 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/rogentoslive @@ -0,0 +1,14 @@ +#!/sbin/runscript +# Copyright 2004-2013 Sabayon +# Distributed under the terms of the GNU General Public License v2 + +depend() { + after x-setup + before xdm +} + +start() { + ebegin "Preparing Live system..." + /usr/libexec/rogentoslive.sh + eend $? +} diff --git a/app-misc/rogentoslive-tools/files/2/rogentoslive.service b/app-misc/rogentoslive-tools/files/2/rogentoslive.service new file mode 100644 index 00000000..92b8455e --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/rogentoslive.service @@ -0,0 +1,11 @@ +[Unit] +Description=Sabayon live system setup +Before=display-manager.service getty.target + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStart=/usr/libexec/rogentoslive.sh + +[Install] +WantedBy=multi-user.target diff --git a/app-misc/rogentoslive-tools/files/2/rogentoslive.sh b/app-misc/rogentoslive-tools/files/2/rogentoslive.sh new file mode 100644 index 00000000..3b5def3d --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/rogentoslive.sh @@ -0,0 +1,183 @@ +#!/bin/bash + +. /sbin/rogentos-functions.sh + +CMDLINE=$(cat /proc/cmdline 2> /dev/null) + +setup_password() { + local cmdline_autoscramble_exist=$(echo ${CMDLINE} | grep autoscramble) + if [ -n "${cmdline_autoscramble_exist}" ]; then + echo "Autoscrambling root and live user passwords" + echo root:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1 + echo ${LIVE_USER}:\`pwgen -s 16\` | chpasswd > /dev/null 2>&1 + fi +} + +setup_x() { + if systemd_running; then + [ -x /sbin/gpu-configuration ] && /sbin/gpu-configuration + else + while [ -e "/etc/x-setup-configuration-running" ]; do + sleep 1 + done + fi +} + +setup_settingsd() { + if [ -e /usr/share/eselect/modules/settingsd.eselect ]; then + if systemd_running; then + eselect settingsd set systemd > /dev/null + elif openrc_running; then + eselect settingsd set openrc > /dev/null + fi + fi +} + +setup_desktop() { + # create LIVE_USER if it does not exist + rogentos_setup_live_user "${LIVE_USER}" "1000" + if [ "${?}" = "1" ]; then + # if user is already available, then setup skel + # Copy ${LIVE_USER} directory + rm -rf /home/${LIVE_USER} + cp /etc/skel /home/${LIVE_USER} -Rp + chown ${LIVE_USER}:users /home/${LIVE_USER} -R + fi + + local liveinst_desktop="/usr/share/applications/liveinst.desktop" + local liveinst_desktop_name="$(basename ${liveinst_desktop})" + if [ -f "${liveinst_desktop}" ]; then + [[ -d "/home/${LIVE_USER}/Desktop" ]] || \ + mkdir -p "/home/${LIVE_USER}/Desktop" + cp "${liveinst_desktop}" "/home/${LIVE_USER}/Desktop" + chown ${LIVE_USER}:users "/home/${LIVE_USER}/Desktop" -R + chmod +x "/home/${LIVE_USER}/Desktop/${liveinst_desktop_name}" + rm -f /etc/skel/Desktop/Anaconda*.desktop \ + /home/${LIVE_USER}/Desktop/Anaconda*.desktop + fi + + # Disable memory eating services + rm -f /etc/xdg/autostart/hplip-systray.desktop \ + /etc/xdg/autostart/beagle-search-autostart.desktop \ + /etc/xdg/autostart/tracker*.desktop \ + /etc/xdg/autostart/magneto.desktop \ + /etc/xdg/autostart/beagled-autostart.desktop \ + /usr/share/autostart/magneto.desktop \ + /usr/share/autostart/nepomukserver.desktop + + # Remove broken entries in /etc/mtab + if [ ! -L /etc/mtab ]; then + sed -i '/.*newroot.*/d' /etc/mtab + fi + + # create /overlay, this way df -h won't bitch + [[ -d "/overlay" ]] || mkdir /overlay + + return 0 +} + +setup_keymap() { + local keymap_toset= + local keymap_toset_model= + + for word in ${CMDLINE}; do + case ${word} in + console-setup/layoutcode=*) + keymap_toset="${word/*=}" + ;; + console-setup/modelcode=*) + keymap_toset_model="-${word/*=}" + ;; + KEYMAP=*) + keymap_toset="${word/*=}" + ;; + keymap=*) + keymap_toset="${word/*=}" + ;; + vconsole.keymap=*) + keymap_toset="${word/*=}" + ;; + vconsole.keymap.model=*) + keymap_toset_model="-${word/*=}" + ;; + esac + done + + if [ -n "${keymap_toset}" ]; then + aggregated_keymap="${keymap_toset}${keymap_toset_model}" + /sbin/keyboard-setup-2 "${aggregated_keymap}" all &> /dev/null + if [ "${?}" = "0" ]; then + openrc_running && /etc/init.d/keymaps restart --nodeps + # systemd not needed here, this script runs before vconsole-setup + fi + fi +} + +setup_locale() { + for word in ${CMDLINE}; do + case ${word} in + locale=*) + lang_toset="${word/*=}" + ;; + LANG=*) + lang_toset="${word/*=}" + ;; + lang=*) + lang_toset="${word/*=}" + ;; + esac + done + if [ -n "${lang_toset}" ]; then + files=( + "/etc/env.d/02locale" + "/etc/locale.conf" + ) + for path in "${files[@]}"; do + if [ -e "$path" ]; then + sed -i "s/^LC_ALL=.*/LC_ALL=${lang_toset}.UTF-8/g" \ + "${path}" + sed -i "s/^LANG=.*/LANG=${lang_toset}.UTF-8/g" "${path}" + sed -i "s/^LANGUAGE=.*/LANGUAGE=${lang_toset}.UTF-8/g" \ + "${path}" + else + echo "LC_ALL=${lang_toset}.UTF-8" > "${path}" + echo "LANG=${lang_toset}.UTF-8" >> "${path}" + echo "LANGUAGE=${lang_toset}.UTF-8" >> "${path}" + fi + done + + sed -i "s/^export LC_ALL=.*/export LC_ALL=${lang_toset}.UTF-8/g" \ + "/etc/profile.env" + sed -i "s/^export LANG=.*/export LANG=${lang_toset}.UTF-8/g" \ + "/etc/profile.env" + sed -i "s/^export LANGUAGE=.*/export LANGUAGE=${lang_toset}.UTF-8/g" \ + "/etc/profile.env" + + fi +} + + +main() { + . /sbin/rogentos-functions.sh + + # Perform configuration only in live mode + if ! rogentos_is_live; then + echo "Skipping Live system configuration" + return 0 + fi + + setup_settingsd + setup_desktop + setup_password + setup_keymap + setup_x + # MOVED HERE TO AVOID RACE CONDITIONS ON WRITING + # /etc/profile.env variables + setup_locale + rogentos_setup_autologin + rogentos_setup_motd + rogentos_setup_vt_autologin + rogentos_setup_oem_livecd +} + +main diff --git a/app-misc/rogentoslive-tools/files/2/sabutil b/app-misc/rogentoslive-tools/files/2/sabutil new file mode 100644 index 00000000..1787c59d --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/sabutil @@ -0,0 +1,667 @@ +#!/bin/bash + +# Initial version by wolfden. +# Later changes by Enlik . + +# last change: 9.03.2012 +# most important changes to last version: +# - abort if non root where needs root permissions +# - fix fdisk -l pasting +# - support for xorg.conf.d +# - reorder options and add rcupdate_pastebin + +USER=$(whoami) +HOMEDIR=${HOME:-/tmp} + +function menu +{ + local selection="" + until [[ "$selection" = "0" ]] ; do + echo "Current Operating System:" + cat /etc/rogentos-release + echo "" + echo "Current Edition:" + cat /etc/rogentos-edition + echo + echo "Pick a choice from menu below:" + + echo "" + echo "1 - Backup & edit xorg.conf and xorg.conf.d" + echo "2 - Restore xorg.conf and xorg.conf.d from backup" + echo "3 - Regenerate Sabayon xorg.conf" + echo "4 - Backup & edit grub.cfg" + echo "5 - Restore grub.cfg from backup" + echo "----------------------------------------" + echo "View and AutoPaste:" + echo " " + echo "01 - Pastebin Xorg configuration files" + echo "02 - Pastebin Xorg.0.log" + echo "03 - Pastebin ~/.xsession-errors" + echo "04 - Pastebin grub.cfg (bootmanager settings)" + echo "05 - Pastebin /var/log/dmesg" + echo "06 - Pastebin system and hardware info" + echo "07 - Pastebin fdisk -l (list the partition tables)" + echo "08 - Pastebin rc-update show (show enabled services and the runlevels)" + echo "09 - Pastebin rc.log" + echo "10 - Pastebin /var/log/messages" + echo "11 - Pastebin kdm.log" + echo "" + echo "0 - Exit" + echo "" + echo -n "Enter selection: " + read selection + echo "" + + case $selection in + 1 ) xorg_backup ; press_enter ; xorg_edit; press_enter ;; + 2 ) xorg_restore ; press_enter ;; + 3 ) xorg_regen ; press_enter ;; + 4 ) grub_backup ; press_enter ; nano -w /boot/grub/grub.cfg; press_enter ;; + 5 ) grub_restore ; press_enter ;; + 01 ) xorg_pastebin ; press_enter ;; + 02 ) xorg0log_pastebin ; press_enter ;; + 03 ) xsessionerrors_pastebin ; press_enter ;; + 04 ) grub_pastebin ; press_enter ;; + 05 ) dmesg_pastebin ; press_enter ;; + 06 ) system_pastebin ; press_enter ;; + 07 ) fdisk_pastebin ; press_enter ;; + 08 ) rcupdate_pastebin ; press_enter ;; + 09 ) rclog_pastebin ; press_enter ;; + 10 ) messages_pastebin ; press_enter ;; + 11 ) kdm_pastebin ; press_enter ;; + + 0 ) ;; + * ) echo "Please be sensible - choose a number that exists in the menu"; press_enter + esac + done + +} + +function press_enter +{ + echo "" + echo -n "Press Enter to continue" + read + clear +} + +function is_root +{ + if [[ $USER != "root" ]]; then + echo "You need to be root to do this." >&2 + return 1 + fi + return 0 +} + +function xorg_regen +{ + is_root || return + + if [[ ! -f "/etc/X11/xorg.conf.rogentos" ]]; then + cat > /etc/X11/xorg.conf.rogentos <=275.xx.xx drivers + #Option "UseEvents" "True" +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 + + SubSection "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" + +EndSection + +Section "DRI" + Mode 0666 +EndSection + +Section "Extensions" + #Option "Composite" "Enable" +EndSection +EOF + fi + + mv -f /etc/X11/xorg.conf /etc/X11/xorg.conf.old + /usr/sbin/x-setup-configuration + + echo "Note: you may want to look to /etc/X11/xorg.conf.d (if it exists), too." +} + +function xorg_backup +{ + is_root || return + + if [[ -f /etc/X11/xorg.conf.BKUP ]]; then + echo "/etc/X11/xorg.conf.BKUP already exists, so new backup wasn't made - aborting." + echo "Now off we go to edit the file...." + return + elif [[ -e /etc/X11/xorg.conf.d.BKUP ]]; then + echo "/etc/X11/xorg.conf.d.BKUP backup already exists, so new backup wasn't made - aborting." + return + fi + + # Delete backup file. If there's no xorg.conf, no stale xorg.conf.BKUP will be kept. + # So xorg_restore will not made new (unexpected) xorg.conf from xorg.conf.BKUP. + rm -f /etc/X11/xorg.conf.BKUP + if [[ -f /etc/X11/xorg.conf ]]; then + echo "Making backup of xorg.conf as /etc/X11/xorg.conf.BKUP" + cp /etc/X11/xorg.conf /etc/X11/xorg.conf.BKUP + else + echo "There's no /etc/X11/xorg.conf so it couldn't be backed up." + fi + + if [[ -e /etc/X11/xorg.conf.d ]]; then + echo "Making backup of /etc/X11/xorg.conf.d/*" + if [[ ! -d /etc/X11/xorg.conf.d ]]; then + echo "!!!" + echo "/etc/X11/xorg.conf.d is not a directory!" + return + fi + mkdir -p /etc/X11/xorg.conf.d.BKUP + rm -f /etc/X11/xorg.conf.d.BKUP/* # dotfiles and subdirectories (who keeps them there?!) are left untouched + cp /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf.d.BKUP/ # and not copied (that's fine) + echo "/etc/X11/xorg.conf.d/* files are backed up in /etc/X11/xorg.conf.d.BKUP/" + else + echo "There's no /etc/X11/xorg.conf.d (directory) so it couldn't be backed up." + fi + + echo "" + echo "INTEL graphics users please read the url below before proceding" + echo "" + echo "http://gentoo-wiki.com/HOWTO_Intel_Onboard_Graphics_Notebooks_Native_Resolution" +} + +function xorg_restore +{ + is_root || return + + echo "Are you sure? This will replace your /etc/X11/xorg.conf and /etc/X11/xorg.conf.d/*.conf." + echo "[Y/n]" + local reply + read reply + if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then + echo "OK, aborting." + return + fi + + if [[ -f /etc/X11/xorg.conf.BKUP ]]; then + echo "xorg.conf backup (/etc/X11/xorg.conf.BKUP) exists, whew!" + cp /etc/X11/xorg.conf.BKUP /etc/X11/xorg.conf + echo "" + echo "The original xorg.conf has been restored" + else + echo "UH OH!! The backup /etc/X11/xorg.conf.BKUP hasn't been made." + echo "If you think you need the file, don't panic, you can copy it from the Live DVD/CD." + fi + + echo "" + + if [[ -d /etc/X11/xorg.conf.d.BKUP ]] \ + && (shopt -s nullglob; f=(/etc/X11/xorg.conf.d.BKUP/*.conf); [[ ${#f[*]} -ne 0 ]] ) + then + echo "The backup /etc/X11/xorg.conf.d.BKUP (directory) exists and contails .conf files." + mkdir -p /etc/X11/xorg.conf.d + # similar notes as for xorg_backup, but files like .disabled are not removed + rm -f /etc/X11/xorg.conf.d/*.conf + cp /etc/X11/xorg.conf.d.BKUP/* /etc/X11/xorg.conf.d/ + echo "Your settings are now restored to /etc/X11/xorg.conf.d/." + fi +} + +function grub_backup +{ + is_root || return + + echo "Note: to modify GRUB configuration, you should edit /etc/default/grub" + echo " or a file in /etc/grub.d and then run grub-mkconfig -o /boot/grub/grub.cfg" + echo " (/boot/grub/grub.cfg shouldn't be edited by hand)." + echo "" + + if [[ -f /boot/grub/grub.cfg.BKUP ]]; then + echo "grub.cfg backup already exists, so the new one wasn't made." + echo "Now off we go to edit the file...." + else + echo "Making backup of grub.cfg as /boot/grub/grub.cfg.BKUP" + cp /boot/grub/grub.cfg /boot/grub/grub.cfg.BKUP + echo "" + fi +} + +function grub_restore +{ + is_root || return + + echo "Are you sure? This will replace your /boot/grub/grub.cfg." + echo "[Y/n]" + local reply + read reply + if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then + echo "OK, aborting." + return + fi + + if [[ -f /boot/grub/grub.cfg.BKUP ]] + then + echo "grub.cfg backup (/boot/grub/grub.cfg.BKUP) exists, whew!" + cp /boot/grub/grub.cfg.BKUP /boot/grub/grub.cfg + echo "" + echo "The original grub.cfg has been restored" + else + echo "UH OH!! The backup script /boot/grub/grub.cfg.BKUP hasn't been made." + echo "Don't panic, you can use the Sabayon installer to repair GRUB." + fi +} + +function horner +{ + +# Quick system info gatherer written for Sabayon GNU/Linux +#(http://rogentoslinux.org) +# Copyright 2008 Richard Edward Horner +# Last modified 2008-11-26 +# Please send all comments, suggestions, bugs and patches to (rich AT +#richhorner DOT com) + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +HOSTNAME=`hostname` +RELEASE=`cat /etc/rogentos-release` +CPU=`uname -p` +KERNEL=`uname -r` +KERN_ARCH=`uname -m` +DISK=`df -lT --exclude-type=tmpfs --exclude-type=rootfs | awk 'BEGIN { total = 0; used = 0 } { if (NR > 1) { total += $3; used += $4 } } END { printf "%.1f/%.1fGB", used / 1000000, total / 1000000 }'` +MEMORY=`cat /proc/meminfo | awk '{ if ($1 == "MemTotal:") { memtot = $2/1000 } else if ($1 == "MemFree:") { memfree = $2/1000 } } END { printf "%d/%dM", memfree, memtot }'` +DAYS=`cat /proc/uptime | awk '{ printf "%.1f", $1/86400 }'` +PROCS=`ps aux | awk 'END { print NR - 2 }'` +RENDERER=`glxinfo | awk -F : '{ if ($1 == "OpenGL renderer string") print $2 }'` + +echo "Sysinfo for '$HOSTNAME': $RELEASE with $KERN_ARCH kernel $KERNEL +on $CPU, HD: $DISK, MEM: $MEMORY, Renderer: $RENDERER, $PROCS procs, +up $DAYS days" + +} + +# echo -e "\a[pastebunz debug ON]" >&2; +# function pastebunz { sed 's/^/[pb] '/ | less; } + +# pastebunz seems to have some limit on max pasted lines, so this would be handy... +function files_pastebin_linelimit +{ + # args: limit file_to_pastebin [file_to_pastebin] ... + # example: file_pastebin_linelimit 30 file1 "file name2" file3 + # first arg: 0 means no limit + # By Enlik + local TMPFILE=~/newbietmp + local LINESLIMIT + local LLIMIT_H + + if [[ $# -le 1 ]]; then + echo "Error: no files to paste (in files_pastebin_linelimit)." >&2 + return 2 + fi + + let LINESLIMIT=$1 + shift + # If there is a limit of lines, we need to make space for file name and blank + # lines to be pasted. Otherwise we have as much space as we want. + if [[ $LINESLIMIT -eq 0 ]]; then + LLIMIT_H="+1" + else + LLIMIT_H=$(( LINESLIMIT - 3 )) + fi + + >"$TMPFILE" || { + echo "Oh no! I can't create temporary file... Aborting." >&2 + return 3 + } + + for file in "$@"; do + echo " --- file: $file ---" + echo " " + if [[ -r $file ]]; then + # This tail guarantees that LAST file name is visible (unless the limit is really small, <= 2 lines) + # (previous one(s) can be wiped by tail due to limit of lines). + # The file name is always visible if there's only one specified + # as argument (unless the limit value is really small, as above). + # All file names are always visible if there's no limit + # of lines, or the limit is big enough. + cat "$file" 2>&1 | tail -n $LLIMIT_H + elif [[ -e $file ]]; then + echo "THIS FILE COULDN'T BE READ." + else + echo "THIS FILE DOESN'T EXIST." + fi + echo " " + done >> "$TMPFILE" + if [[ $LINESLIMIT -eq 0 ]]; then + cat "$TMPFILE" | pastebunz + else + tail -n $LINESLIMIT "$TMPFILE" | pastebunz + fi + echo "** Please see the link above! **" + + rm "$TMPFILE" + return 0 +} + +function files_pastebin +{ + files_pastebin_linelimit 0 "$@" +} + +function system_pastebin +{ + echo -n "Please wait, it is going to take a while..." + local PASTE_TMP=/tmp/sabutil-tmp + + >"$PASTE_TMP" || { + echo "Oh no! I can't create temporary file... Aborting." + return 1 + } + + echo " + sh /sbin/logscript.sh + " >> "$PASTE_TMP" + sh "/sbin/logscript.sh" >> "$PASTE_TMP" + + cat "$PASTE_TMP" + cat "$PASTE_TMP" | pastebunz + echo "*** Please see the link above. ***" + rm "$PASTE_TMP" +} + +function xorg0log_pastebin +{ + tail -n 150 /var/log/Xorg.0.log + files_pastebin_linelimit 150 /var/log/Xorg.0.log +} + +function xsessionerrors_pastebin +{ + cat "$HOMEDIR/.xsession-errors" | tail -n 10 + files_pastebin_linelimit 150 "$HOMEDIR/.xsession-errors" + if [[ $USER = "root" ]]; then + echo + echo "Notice: root's .xsession-errors file has been pasted." + echo "To get .xsession-errors from your regular account on which" + echo "you are logged using GDM, KDM or so (which is probably what you want)," + echo "run this script as that user, not root, or pastebin .xsession-errors" + echo "from YOUR home directory manually." + echo + fi +} + +function dmesg_pastebin +{ + cat /var/log/dmesg + files_pastebin_linelimit 150 /var/log/dmesg +} + +function grub_pastebin +{ + cat /boot/grub/grub.cfg + files_pastebin /boot/grub/grub.cfg +} + +function fdisk_pastebin +{ + is_root || return # fdisk -l + + local PASTE_TMP=/tmp/sabutil-tmp + + >"$PASTE_TMP" || { + echo "Oh no! I can't create temporary file... Aborting." + return 1 + } + + ( + echo " + fdisk -l + "; + fdisk -l; + ) > "$PASTE_TMP" + + cat "$PASTE_TMP" + cat "$PASTE_TMP" | pastebunz + echo "*** Please see the link above. ***" + rm "$PASTE_TMP" +} + +function messages_pastebin +{ + tail -n 150 /var/log/messages + files_pastebin_linelimit 150 /var/log/messages +} + +function kdm_pastebin +{ + cat /var/log/kdm.log + files_pastebin_linelimit 150 /var/log/kdm.log +} + +function rclog_pastebin +{ + if [[ -f /var/log/rc.log ]]; then + cat /var/log/rc.log | tail -n 10 + files_pastebin_linelimit 150 /var/log/rc.log + else + echo "You Don't Have rc.log enabled in your /etc/rc.log" + echo " To enable, edit /etc/rc.log change NO to YES for rc_logger= " + echo "" + fi +} + +function rcupdate_pastebin +{ + local PASTE_TMP=/tmp/sabutil-tmp + + >"$PASTE_TMP" || { + echo "Oh no! I can't create temporary file... Aborting." + return 1 + } + + ( + echo " + rc-update show + "; + rc-update show + ) > "$PASTE_TMP" + + cat "$PASTE_TMP" + cat "$PASTE_TMP" | pastebunz + echo "*** Please see the link above. ***" + rm "$PASTE_TMP" +} + +function xorg_pastebin +{ + echo "These files will be pasted (don't worry if any of them don't exist):" + ls -l /etc/X11/xorg.conf /etc/X11/xorg.conf.d/* + files_pastebin /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf +} + +function xorg_edit +{ + is_root &> /dev/null || echo "You are not root. You will only be able to view files." + + local xorgfiles=() file + if (shopt -s nullglob; f=(/etc/X11/xorg.conf.d/*.conf); [[ ${#f[*]} -ne 0 ]] ); then + xorgfiles=( /etc/X11/xorg.conf.d/* ) # let's put all non-dot files; warning for non-conf is below + fi + + if [[ -f /etc/X11/xorg.conf ]]; then + xorgfiles+=( /etc/X11/xorg.conf ) + fi + + if [[ ${#xorgfiles[*]} -eq 0 ]]; then + echo "I can't find any Xorg configuration files." + echo "There's no /etc/X11/xorg.conf or .conf files in /etc/X11/xorg.conf.d/ directory." + echo "Xorg uses autodected settings." + else + echo "These files affect your Xorg configuration." + echo "See http://fedoraproject.org/wiki/Input_device_configuration#xorg.conf.d for more informations." + echo "Select a file to edit or type q and press Enter to quit." + select file in "${xorgfiles[@]}"; do + if [[ -n $file ]]; then + # Not sure about files that don't start with a number and a hyphen - are they used? + if [[ ${file##*.} != "conf" ]]; then + echo "Warning: this file has no .conf suffix and thus will be ignored by Xorg." + press_enter + fi + nano -w "$file" + echo "Select a file to edit or type q and press Enter to quit." + elif [[ $REPLY = "q" || $REPLY = "Q" ]]; then + break + fi + done + fi +} + +clear + +if [[ $1 = "menu" ]]; then + if [[ $EUID -ne 0 ]]; then + echo "This script should be run as root, or by someone in the root group. Some commands will not work for you." 1>&2 + echo "" + fi + menu +elif [[ $1 = "--help" || $1 = "-h" ]]; then + echo "usage:" + echo "$0 - will print some basic system infos" + echo "$0 menu - will show you menu" +else + horner + echo "" + echo "Specify --help or -h to get help." + fi diff --git a/app-misc/rogentoslive-tools/files/2/vga-cmd-parser b/app-misc/rogentoslive-tools/files/2/vga-cmd-parser new file mode 100644 index 00000000..1e443171 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/vga-cmd-parser @@ -0,0 +1,53 @@ +#!/usr/bin/python +# Copyright 2008 Fabio Erculiani, Sabayon Linux Chief Architect +# parses vga= parameters from cmdline given by isolinux and returns the right resolution +# Shut up! + +res_map = { + "0x385": ("640x400",24), + "0x312": ("640x480",24), + "0x315": ("800x600",24), + "0x318": ("1024x768",24), + "0x31b": ("1280x1024",24), + "0x330": ("640x400",16), + "0x33E": ("640x400",24), + "0x331": ("640x480",16), + "0x33F": ("640x480",24), + "0x332": ("800x600",16), + "0x340": ("800x600",24), + "0x333": ("1024x768",16), + "0x341": ("1024x768",24), + "0x334": ("1152x864",16), + "0x342": ("1152x864",24), + "0x335": ("1280x960",16), + "0x343": ("1280x960",24), + "0x336": ("1280x1024",16), + "0x344": ("1280x1024",24), + "0x337": ("1400x1050",16), + "0x345": ("1400x1050",24), + "0x338": ("1600x1200",16), + "0x346": ("1600x1200",24), + "0x339": ("1792x1344",16), + "0x347": ("1792x1344",24), + "0x33A": ("1856x1392",16), + "0x348": ("1856x1392",24), + "0x33B": ("1920x1440",16), + "0x349": ("1920x1440",24), + "0x33C": ("2048x1536",16), + "0x34A": ("2048x1536",24) +} + +f = open("/proc/cmdline") +cmdline = f.readline().strip().split() +cmdline.reverse() +for item in cmdline: + if item.startswith("vga="): + item_split = item.split("=") + if len(item_split) == 2: + data = item_split[1] + try: + if res_map.get(data) != None: + print res_map[data][0],res_map[data][1] + break + except TypeError: + pass diff --git a/app-misc/rogentoslive-tools/files/2/x-setup-configuration b/app-misc/rogentoslive-tools/files/2/x-setup-configuration new file mode 100644 index 00000000..b8747097 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/x-setup-configuration @@ -0,0 +1,46 @@ +#!/bin/bash + +# get livecd functions +source /sbin/livecd-functions.sh +source /sbin/rogentos-functions.sh + +runtime_linking_proprietary_drivers() { + if [ -d "/lib/nvidia" ] || [ -d "/lib/fglrx" ]; then + 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 + depmod -a &> /dev/null + 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 + depmod -a &> /dev/null + 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 + depmod -a &> /dev/null + 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 + depmod -a &> /dev/null + fi + fi +} + +# create seed +rm -f /etc/x-setup-configuration-running +touch /etc/x-setup-configuration-running + +# Prepare Video Cards Proprietary Drivers +if rogentos_is_live; then + runtime_linking_proprietary_drivers +fi +/sbin/gpu-configuration &> /dev/null + +# delete seed +rm -f /etc/x-setup-configuration-running diff --git a/app-misc/rogentoslive-tools/files/2/x-setup-init.d b/app-misc/rogentoslive-tools/files/2/x-setup-init.d new file mode 100644 index 00000000..0c486c06 --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/x-setup-init.d @@ -0,0 +1,26 @@ +#!/sbin/runscript +# Copyright 2009-2013 Sabayon +# Distributed under the terms of the GNU General Public License v2 + +depend() { + after mtab + before hostname + before xdm +} + + + +start() { + . /sbin/rogentos-functions.sh + + ebegin "Configuring GPUs and input devices" + if rogentos_is_live; then + start-stop-daemon --start --background --pidfile /var/run/x-setup.pid \ + --make-pidfile --exec /usr/sbin/x-setup-configuration + eend 0 + return 0 + fi + + /usr/libexec/x-setup.sh > /dev/null + eend ${?} +} diff --git a/app-misc/rogentoslive-tools/files/2/x-setup.service b/app-misc/rogentoslive-tools/files/2/x-setup.service new file mode 100644 index 00000000..58ffa4af --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/x-setup.service @@ -0,0 +1,14 @@ +# This unit is meant to run only after install. + +[Unit] +Description=GPUs and input devices setup +ConditionKernelCommandLine=!cdroot +Before=display-manager.service + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStart=/usr/libexec/x-setup.sh + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/app-misc/rogentoslive-tools/files/2/x-setup.sh b/app-misc/rogentoslive-tools/files/2/x-setup.sh new file mode 100644 index 00000000..4463a66b --- /dev/null +++ b/app-misc/rogentoslive-tools/files/2/x-setup.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +. /sbin/rogentos-functions.sh + +REDETECT=$(cat /proc/cmdline | grep "gpudetect") + +gpus_same() { + # $1 and $2: output lines from "lspci" + local id1 id2 # [xxxx:]xx:xx.x + local dev1 dev2 # vendor and device: xxxx:xxxx + id1=$(echo "$1" | awk '/ VGA / { print $1 }') + id2=$(echo "$2" | awk '/ VGA / { print $1 }') + if [ -z "$id1" ] || [ -z "$id2" ]; then + return 1 + fi + dev1=$(lspci -s "$id1" -n | awk '{ print $3 }') + dev2=$(lspci -s "$id2" -n | awk '{ print $3 }') + [ "$dev1" = "$dev2" ] +} + + +if [ -e /first_time_run ] || [ ! -e /etc/gpu-detector.conf ] \ + || [ -n "${REDETECT}" ]; then + echo "Configuring GPUs and input devices for the first time" + lspci | grep ' VGA ' > /etc/gpu-detector.conf + /usr/sbin/x-setup-configuration + exit 0 +fi + +infostr_run="Configuring GPUs and input devices" +infostr_skip="Skipping GPUs and input devices configuration" +lspci_vga=$(lspci | grep ' VGA ') +stored_vga=$(cat /etc/gpu-detector.conf) + +if [ "${lspci_vga}" != "${stored_vga}" ]; then + # Strings are different, let's do the more "heavy" and accurate comparison. + if gpus_same "${lspci_vga}" "${stored_vga}"; then + # this may happen after vendor changes its name etc. + # and PCI ID file is updated + echo "${infostr_skip}, only updating GPU information file" + else + echo "${infostr_run}" + /usr/sbin/x-setup-configuration + fi + echo "${lspci_vga}" > /etc/gpu-detector.conf + exit 0 +fi + +echo "${infostr_skip}" -- cgit v1.2.3