summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlackNoxis <steven.darklight@gmail.com>2014-11-21 18:07:24 +0200
committerBlackNoxis <steven.darklight@gmail.com>2014-11-21 18:07:24 +0200
commitdacc0bfae08c88125035f08cd136641eee95137f (patch)
treeb2af748741e2ab9ebca0f57d8ce32b5bc75b1a58
Kogaion live git added
-rw-r--r--Makefile57
-rw-r--r--bashlogin6
-rw-r--r--cdeject11
-rw-r--r--cdeject.service13
-rw-r--r--cdeject.sh12
-rw-r--r--graphical_start13
-rw-r--r--graphical_start.service12
-rw-r--r--graphical_start.sh6
-rw-r--r--installer-gui15
-rw-r--r--installer-gui.service12
-rw-r--r--installer-gui.sh8
-rw-r--r--installer-text13
-rw-r--r--installer-text.service11
-rw-r--r--installer-text.sh7
-rw-r--r--kogaion-functions.sh284
-rw-r--r--kogaion-live-check27
-rw-r--r--kogaion-welcome-loader10
-rw-r--r--kogaion-welcome-loader.desktop7
-rw-r--r--kogaionlive14
-rw-r--r--kogaionlive.service11
-rw-r--r--kogaionlive.sh177
-rw-r--r--livecd-functions.sh633
-rw-r--r--livespawn10
-rw-r--r--logscript.sh111
-rw-r--r--net-setup65
-rw-r--r--sabutil668
-rw-r--r--vga-cmd-parser53
-rw-r--r--x-setup-init.d26
-rw-r--r--x-setup.service14
-rw-r--r--x-setup.sh54
30 files changed, 2360 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f624ea3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,57 @@
+SUBDIRS =
+DESTDIR =
+UBINDIR ?= /usr/bin
+LIBDIR ?= /usr/lib
+SBINDIR ?= /sbin
+USBINDIR ?= /usr/sbin
+BINDIR ?= /bin
+LIBEXECDIR ?= /usr/libexec
+SYSCONFDIR ?= /etc
+SYSTEMD_UNITDIR ?= $(LIBDIR)/systemd/system
+SYSV_INITDIR = /etc/init.d
+
+all:
+ for d in $(SUBDIRS); do $(MAKE) -C $$d; done
+
+clean:
+ for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
+
+install:
+ for d in $(SUBDIRS); do $(MAKE) -C $$d install; done
+
+ install -d $(DESTDIR)/$(LIBEXECDIR)
+ install -m 0755 installer-{text,gui}.sh $(DESTDIR)/$(LIBEXECDIR)/
+ install -m 0755 kogaionlive.sh $(DESTDIR)/$(LIBEXECDIR)/
+ install -m 0755 x-setup.sh $(DESTDIR)/$(LIBEXECDIR)/
+ install -m 0755 cdeject.sh $(DESTDIR)/$(LIBEXECDIR)/
+ install -m 0755 graphical_start.sh ${DESTDIR}/${LIBEXECDIR}/
+
+ install -d $(DESTDIR)/$(SBINDIR)
+ install -d $(DESTDIR)/$(BINDIR)
+ install -m 0755 logscript.sh $(DESTDIR)/$(SBINDIR)/
+ install -m 0755 *-functions.sh $(DESTDIR)/$(SBINDIR)/
+ install -m 0755 bashlogin $(DESTDIR)/$(BINDIR)/
+ install -m 0755 vga-cmd-parser $(DESTDIR)/$(BINDIR)/
+
+ install -d $(DESTDIR)/$(USBINDIR)
+ install -m 0755 net-setup $(DESTDIR)/$(USBINDIR)/
+
+ install -d $(DESTDIR)/$(UBINDIR)
+ install -m 0755 livespawn $(DESTDIR)/$(UBINDIR)/
+ install -m 0755 sabutil $(DESTDIR)/$(UBINDIR)/
+ install -m 0755 kogaion-live-check $(DESTDIR)/$(UBINDIR)/
+ install -m 0755 kogaion-welcome-loader $(DESTDIR)/$(UBINDIR)/
+
+ install -d $(DESTDIR)/$(SYSCONFDIR)/kogaion
+ install -m 0644 kogaion-welcome-loader.desktop $(DESTDIR)/$(SYSCONFDIR)/kogaion
+
+ install -d $(DESTDIR)/$(SYSTEMD_UNITDIR)/
+ install -m 0644 *.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/
+
+ install -d $(DESTDIR)/$(SYSV_INITDIR)/
+ install -m 0755 x-setup-init.d $(DESTDIR)/$(SYSV_INITDIR)/x-setup
+ install -m 0755 graphical_start ${DESTDIR}/${SYSV_INITDIR}
+ install -m 0755 kogaionlive $(DESTDIR)/$(SYSV_INITDIR)/
+ install -m 0755 installer-gui $(DESTDIR)/$(SYSV_INITDIR)/
+ install -m 0755 installer-text $(DESTDIR)/$(SYSV_INITDIR)/
+ install -m 0755 cdeject $(DESTDIR)/$(SYSV_INITDIR)/
diff --git a/bashlogin b/bashlogin
new file mode 100644
index 0000000..3468918
--- /dev/null
+++ b/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/cdeject b/cdeject
new file mode 100644
index 0000000..302a341
--- /dev/null
+++ b/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/cdeject.service b/cdeject.service
new file mode 100644
index 0000000..96f4424
--- /dev/null
+++ b/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/cdeject.sh b/cdeject.sh
new file mode 100644
index 0000000..ae75ae8
--- /dev/null
+++ b/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/graphical_start b/graphical_start
new file mode 100644
index 0000000..ce95220
--- /dev/null
+++ b/graphical_start
@@ -0,0 +1,13 @@
+#!/sbin/runscript
+# Copyright 2013 Argent and Argent
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ after kogaionlive
+}
+
+start() {
+ ebegin "Starting the Graphical Interface"
+ /usr/libexec/graphical_start.sh
+ eend $?
+}
diff --git a/graphical_start.service b/graphical_start.service
new file mode 100644
index 0000000..6def328
--- /dev/null
+++ b/graphical_start.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Graphical Starter Config File
+After=kogaionlive.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=false
+ExecStart=/usr/libexec/graphical_start.sh
+
+[Install]
+Alias=graphical_start.service
+WantedBy=multi-user.target
diff --git a/graphical_start.sh b/graphical_start.sh
new file mode 100644
index 0000000..0337a1b
--- /dev/null
+++ b/graphical_start.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+CMD=$(cat /etc/conf.d/xdm | grep "DISPLAY" | cut -d '"' -f 2)
+if [ "${CMD}" == "lxdm" ] || [ "${CMD}" == "gdm" ] || [ "${CMD}" == "lightdm" ] || [ "${CMD}" == "kdm" ] ; then
+ /usr/bin/systemctl start "${CMD}".service
+fi
diff --git a/installer-gui b/installer-gui
new file mode 100644
index 0000000..9133b6b
--- /dev/null
+++ b/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 kogaionlive
+ need dbus
+}
+
+start() {
+ ebegin "Configuring the installer"
+ /usr/libexec/installer-gui.sh
+ eend $?
+}
diff --git a/installer-gui.service b/installer-gui.service
new file mode 100644
index 0000000..82491c8
--- /dev/null
+++ b/installer-gui.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Kogaion installer setup
+Before=display-manager.service
+After=kogaionlive.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/libexec/installer-gui.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/installer-gui.sh b/installer-gui.sh
new file mode 100644
index 0000000..c8623dc
--- /dev/null
+++ b/installer-gui.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+. /sbin/kogaion-functions.sh
+
+if kogaion_is_gui_install; then
+ kogaion_setup_autologin
+ kogaion_setup_gui_installer
+fi
diff --git a/installer-text b/installer-text
new file mode 100644
index 0000000..faada20
--- /dev/null
+++ b/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/installer-text.service b/installer-text.service
new file mode 100644
index 0000000..5874872
--- /dev/null
+++ b/installer-text.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Argent text installer setup
+After=kogaionlive.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/libexec/installer-text.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/installer-text.sh b/installer-text.sh
new file mode 100644
index 0000000..0324e51
--- /dev/null
+++ b/installer-text.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+. /sbin/kogaion-functions.sh
+
+if kogaion_is_text_install; then
+ kogaion_setup_text_installer
+fi
diff --git a/kogaion-functions.sh b/kogaion-functions.sh
new file mode 100644
index 0000000..6229b6f
--- /dev/null
+++ b/kogaion-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:-kogaionuser}
+
+kogaion_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
+ kogaion_is_normal_boot && kogaion_fixup_gnome_autologin_session
+}
+
+kogaion_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
+}
+
+kogaion_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 "kogaionuser" \
+ -m -N -p "" -s /bin/bash ${live_uid} "${live_user}"
+ return 0
+ fi
+ return 1
+}
+
+kogaion_setup_motd() {
+ echo -e "\n\tWelcome to `cat /etc/kogaion-edition`\n\t`uname -p`\n\t`uname -o` `uname -r`\n" > /etc/motd
+}
+
+kogaion_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
+}
+
+kogaion_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
+}
+
+kogaion_is_live() {
+ local cmdl=$(cat /proc/cmdline | grep cdroot)
+ if [ -n "${cmdl}" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+kogaion_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 kogaionuser "${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 kogaionuser 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
+kogaion_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
+}
+
+kogaion_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
+ kogaion_setup_text_installer_motd
+}
+
+kogaion_setup_text_installer_motd() {
+ echo "Welcome to Kogaion Linux Text installation." >> /etc/motd
+ echo "to run the installation type: installer <and PRESS ENTER>" >> /etc/motd
+}
+
+kogaion_is_text_install() {
+ local _is_install=$(cat /proc/cmdline | grep installer-text)
+ if [ -n "${_is_install}" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+kogaion_is_gui_install() {
+ local _is_install=$(cat /proc/cmdline | grep installer-gui)
+ if [ -n "${_is_install}" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+kogaion_is_live_install() {
+ ( kogaion_is_text_install || kogaion_is_gui_install ) && return 0
+ return 1
+}
+
+kogaion_is_mce() {
+ local _is_mce=$(cat /proc/cmdline | grep kogaionmce)
+ if [ -n "${_is_mce}" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+kogaion_is_normal_boot() {
+ if ! kogaion_is_mce && ! kogaion_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/kogaion-live-check b/kogaion-live-check
new file mode 100644
index 0000000..adab0f9
--- /dev/null
+++ b/kogaion-live-check
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# kogaion_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.kogaion.ro/"
diff --git a/kogaion-welcome-loader b/kogaion-welcome-loader
new file mode 100644
index 0000000..bbb0c60
--- /dev/null
+++ b/kogaion-welcome-loader
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+ROGENTOS_LOADER="/usr/bin/xdg-open"
+ROGENTOS_URL=${ROGENTOS_URL:-http://www.kogaion.ro?install_welcome=1}
+
+# load Sabayon URL
+[[ -x "${ROGENTOS_LOADER}" ]] && ${ROGENTOS_LOADER} ${ROGENTOS_URL} &
+
+# remove myself from autostart
+rm ~/.config/autostart/kogaion-welcome-loader.desktop -f
diff --git a/kogaion-welcome-loader.desktop b/kogaion-welcome-loader.desktop
new file mode 100644
index 0000000..2c39068
--- /dev/null
+++ b/kogaion-welcome-loader.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Name=kogaion-loader
+Exec=kogaion-welcome-loader
+Icon=system-run
+Comment=Kogaion Linux post-install Welcome Screen
+Terminal=false
diff --git a/kogaionlive b/kogaionlive
new file mode 100644
index 0000000..97543eb
--- /dev/null
+++ b/kogaionlive
@@ -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/kogaionlive.sh
+ eend $?
+}
diff --git a/kogaionlive.service b/kogaionlive.service
new file mode 100644
index 0000000..e9d5308
--- /dev/null
+++ b/kogaionlive.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Argent live system setup
+Before=display-manager.service getty.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/libexec/kogaionlive.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/kogaionlive.sh b/kogaionlive.sh
new file mode 100644
index 0000000..38b3647
--- /dev/null
+++ b/kogaionlive.sh
@@ -0,0 +1,177 @@
+#!/bin/bash
+
+. /sbin/kogaion-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() {
+ [ -x /sbin/gpu-configuration ] && /sbin/gpu-configuration
+}
+
+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
+ kogaion_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/kogaion-functions.sh
+
+ # Perform configuration only in live mode
+ if ! kogaion_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
+ kogaion_setup_autologin
+ kogaion_setup_motd
+ kogaion_setup_vt_autologin
+ kogaion_setup_oem_livecd
+}
+
+main
diff --git a/livecd-functions.sh b/livecd-functions.sh
new file mode 100644
index 0000000..91fe852
--- /dev/null
+++ b/livecd-functions.sh
@@ -0,0 +1,633 @@
+#!/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)
+ ifconfig ${iface} ${IP} broadcast ${BROADCAST} netmask ${NETMASK}
+ if [ -n "${GATEWAY}" ]
+ then
+ 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 "# Kogaion 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 opts ifname
+ for ifname in /sys/class/net/*; do
+ [[ ! -d "${ifname}" ]] && continue
+ ifname=$(basename "${ifname}")
+ [[ ${ifname} == "lo" ]] && continue
+ opts="${opts} '${ifname}' '$(get_ifdesc ${ifname})'"
+ done
+
+ 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/livespawn b/livespawn
new file mode 100644
index 0000000..44d7257
--- /dev/null
+++ b/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/logscript.sh b/logscript.sh
new file mode 100644
index 0000000..1c822de
--- /dev/null
+++ b/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/kogaion-release`
+OS_EDITION=`cat /etc/kogaion-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/net-setup b/net-setup
new file mode 100644
index 0000000..e84de48
--- /dev/null
+++ b/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/sabutil b/sabutil
new file mode 100644
index 0000000..ce667ac
--- /dev/null
+++ b/sabutil
@@ -0,0 +1,668 @@
+#!/bin/bash
+
+# Initial version by wolfden.
+# Later changes by Enlik <poczta-sn at gazeta.pl>.
+
+# 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/kogaion-release
+ echo ""
+ echo "Current Edition:"
+ cat /etc/kogaion-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 Kogaion 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.kogaion" ]]; then
+ cat > /etc/X11/xorg.conf.kogaion <<EOF
+Section "Module"
+ SubSection "extmod"
+ Option "omit xfree86-dga"
+ EndSubSection
+ Load "i2c"
+ Load "ddc"
+ Load "synaptics"
+ Load "vbe"
+# Load "dri"
+EndSection
+
+
+Section "ServerFlags"
+ Option "AllowMouseOpenFail" "true"
+EndSection
+
+Section "InputDevice"
+ Identifier "Synaptics1"
+ Driver "synaptics"
+ Option "SendCoreEvents" "true"
+ Option "Device" "/dev/psaux"
+ Option "Protocol" "auto-dev"
+ Option "HorizScrollDelta" "0"
+ Option "SHMConfig" "on"
+ # For ALPS/MacBook TouchPads
+ #Option "MaxSpeed" "0.7"
+ #Option "MinSpeed" "0.18"
+ #Option "AccelFactor" "0.08"
+ #Option "TopEdge" "120"
+ #Option "LeftEdge" "120"
+ #Option "BottomEdge" "830"
+ #Option "RightEdge" "650"
+ #Option "FingerLow" "25"
+ #Option "FingerHigh" "30"
+ # MacBook touchpad
+ #Option "MaxTapTime" "180"
+ #Option "MaxTapMove" "220"
+ #Option "MaxDoubleTapTime" "180"
+ #Option "VertScrollDelta" "20"
+ #Option "HorizScrollDelta" "50"
+ #Option "TapButton2" "3"
+ #Option "TapButton3" "2"
+ #Option "VertTwoFingerScroll" "1"
+
+ # Do you keep moving the mouse while typing? Try this trick.
+ #synclient TouchpadOff=1 disable your synaptics touchpad
+ #synclient TouchpadOff=0 enable your synaptics touchpad
+EndSection
+
+
+# **********************************************************************
+# 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"
+ # UseEvents is causing segmentation faults with
+ # NVIDIA 6xxx, 7xxx and >=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
+ /sbin/gpu-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 Kogaion installer to repair GRUB."
+ fi
+}
+
+function horner
+{
+
+# Quick system info gatherer written for Sabayon GNU/Linux and
+# adapted for Argent and Argent GNU/Linux
+#(http://kogaion.ro)
+# 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 <http://www.gnu.org/licenses/>.
+
+HOSTNAME=`hostname`
+RELEASE=`cat /etc/kogaion-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 <sn at ubucentrum.net>
+ 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/vga-cmd-parser b/vga-cmd-parser
new file mode 100644
index 0000000..1e44317
--- /dev/null
+++ b/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/x-setup-init.d b/x-setup-init.d
new file mode 100644
index 0000000..12f201a
--- /dev/null
+++ b/x-setup-init.d
@@ -0,0 +1,26 @@
+#!/sbin/runscript
+# Copyright 2009-2013 Sabayon
+# Copyright 2013 Kogaion
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ after mtab
+ before hostname
+ before xdm
+}
+
+
+
+start() {
+ . /sbin/kogaion-functions.sh
+
+ ebegin "Configuring GPUs and input devices"
+ if kogaion_is_live; then
+ /sbin/gpu-configuration > /dev/null
+ eend 0
+ return 0
+ fi
+
+ /usr/libexec/x-setup.sh > /dev/null
+ eend ${?}
+}
diff --git a/x-setup.service b/x-setup.service
new file mode 100644
index 0000000..58ffa4a
--- /dev/null
+++ b/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/x-setup.sh b/x-setup.sh
new file mode 100644
index 0000000..e2f2533
--- /dev/null
+++ b/x-setup.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+if [ ! -d /proc/bus/pci ]; then
+ echo "PCI bus not available" >&2
+ exit 0
+fi
+
+. /sbin/kogaion-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
+ /sbin/gpu-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}"
+ /sbin/gpu-configuration
+ fi
+ echo "${lspci_vga}" > /etc/gpu-detector.conf
+ exit 0
+fi
+
+echo "${infostr_skip}"