Compare commits
85 Commits
milestone2
...
master
Author | SHA1 | Date | |
---|---|---|---|
cb4846db05 | |||
7d4c087385 | |||
62d4d51238 | |||
ceafdd97e4 | |||
2d7f432a36 | |||
c6bc954c16 | |||
595e868cfa | |||
dfb1a9f5cb | |||
9f2d8e237b | |||
d6cbd5326d | |||
d739d6d3c6 | |||
4e0e3f5faf | |||
c1105c976b | |||
2777bff174 | |||
c3df1bc57d | |||
a6acd7d48f | |||
f8cf76e577 | |||
67ba1a18c3 | |||
4d6ef8a665 | |||
cf701ffc86 | |||
6cda6f2788 | |||
8965b60c8b | |||
7fd882da85 | |||
081784b702 | |||
9ea0f12e60 | |||
05e9f294ec | |||
e80b4fc1a1 | |||
be4dd98c7c | |||
d567af8906 | |||
1c1cd54ad6 | |||
ba52c3f82b | |||
30f9d333d2 | |||
22e6011467 | |||
033a5b9c7e | |||
2da377e6df | |||
f3ef2574de | |||
05c2d2cf43 | |||
97242a1b52 | |||
81d0b9b78d | |||
b4e152cfa7 | |||
8a2ebd8df0 | |||
df1571b7a6 | |||
29e5202c60 | |||
91d9c11c5e | |||
806b8138d5 | |||
ed2bd4ff17 | |||
a75aae653e | |||
2c2900db7d | |||
7c2ebe3873 | |||
381aed1e7b | |||
2244f457a3 | |||
8598291d84 | |||
c87575239b | |||
cc247c5237 | |||
2e1ef68602 | |||
3a7c33f32b | |||
f9e0066c8d | |||
f6ec1e4476 | |||
7f9aac7a35 | |||
e42a6503e6 | |||
a7fa2ad01e | |||
0be567ca39 | |||
9e035594d9 | |||
29c1787405 | |||
f7e9e7befb | |||
d18482236a | |||
c7a0828eaa | |||
fdfb337dcb | |||
29ea391692 | |||
94b6db3676 | |||
57701f3c38 | |||
7a526dab3a | |||
95b7da8f5b | |||
a3d787b75c | |||
dccee1c9dd | |||
8740e2a830 | |||
b011e2aa40 | |||
10aa2ca3ee | |||
c2a12f57be | |||
a6f03cc4b3 | |||
7cd0c08d6b | |||
9f585a34c9 | |||
97a897b29e | |||
f8beae5cbe | |||
d6e8096815 |
1
BUGS
1
BUGS
@ -1,2 +1 @@
|
|||||||
- the scripts localtime and xorg should have a timeout
|
|
||||||
- the script filesystems should delete the unused directories found in /mnt
|
- the script filesystems should delete the unused directories found in /mnt
|
47
Makefile
47
Makefile
@ -1,22 +1,25 @@
|
|||||||
# Makefile for postplug
|
# Makefile for postplug
|
||||||
# Copyright (C) 2004-2005 by Silvan Calarco <silvan.calarco@qilinux.it>
|
# Copyright (C) 2004-2024 by Silvan Calarco <silvan.calarco@qilinux.it>
|
||||||
# Copyright (C) 2004-2007 by Davide Madrisan <davide.madrisan@gmail.com>
|
# Copyright (C) 2004-2007 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
|
|
||||||
include VERSION
|
include VERSION
|
||||||
|
|
||||||
PACKAGE = postplug
|
PACKAGE = postplug
|
||||||
|
|
||||||
prefix = /usr
|
prefix := /usr
|
||||||
exec_prefix = $(prefix)
|
exec_prefix := $(prefix)
|
||||||
sysconfdir = /etc
|
sysconfdir := /etc
|
||||||
bindir = $(exec_prefix)/bin
|
bindir = $(exec_prefix)/bin
|
||||||
sbindir = $(exec_prefix)/sbin
|
libdir := $(prefix)/lib
|
||||||
sbin = /sbin
|
sbindir := $(bindir)
|
||||||
|
sbin := $(bindir)
|
||||||
mandir = $(prefix)/share/man
|
mandir = $(prefix)/share/man
|
||||||
datadir = $(prefix)/share
|
datadir = $(prefix)/share
|
||||||
initrddir = $(sysconfdir)/rc.d/init.d
|
|
||||||
logrotatedir = $(sysconfdir)/logrotate.d/
|
logrotatedir = $(sysconfdir)/logrotate.d/
|
||||||
sysconfigdir= $(sysconfdir)/sysconfig
|
sysconfigdir= $(sysconfdir)/sysconfig
|
||||||
|
systemdunitdir := $(prefix)/lib/systemd/system
|
||||||
|
udevdir := $(prefix)/lib/udev
|
||||||
|
udevrulesdir := $(udevdir)/rules.d
|
||||||
localesdir = $(datadir)/locale
|
localesdir = $(datadir)/locale
|
||||||
|
|
||||||
srcdir = .
|
srcdir = .
|
||||||
@ -42,7 +45,6 @@ pck_catalogs := $(wildcard po/*.po)
|
|||||||
pck_plugins := $(wildcard postplug.d/*)
|
pck_plugins := $(wildcard postplug.d/*)
|
||||||
pck_sysconfig := $(wildcard sysconfig/*)
|
pck_sysconfig := $(wildcard sysconfig/*)
|
||||||
pck_defs := postplug/postplug-defs
|
pck_defs := postplug/postplug-defs
|
||||||
pck_initscript = postplug/postplug-initscript
|
|
||||||
pck_logrotate = postplug/postplug-logrotate
|
pck_logrotate = postplug/postplug-logrotate
|
||||||
pck_postplug = postplug/postplug
|
pck_postplug = postplug/postplug
|
||||||
pck_scripts := $(wildcard scripts/*)
|
pck_scripts := $(wildcard scripts/*)
|
||||||
@ -61,7 +63,7 @@ install-locales: locales
|
|||||||
echo "installing i18n file for language \`$$lang'...";\
|
echo "installing i18n file for language \`$$lang'...";\
|
||||||
dir="$(DESTDIR)$(localesdir)/$$lang/LC_MESSAGES";\
|
dir="$(DESTDIR)$(localesdir)/$$lang/LC_MESSAGES";\
|
||||||
$(INSTALL_DIR) $$dir;\
|
$(INSTALL_DIR) $$dir;\
|
||||||
$(INSTALL_DATA) $${f/.po/.mo} $$dir/$(PACKAGE).mo;\
|
$(INSTALL_DATA) po/$$lang.mo $$dir/$(PACKAGE).mo;\
|
||||||
done
|
done
|
||||||
|
|
||||||
install-defs: $(pck_defs)
|
install-defs: $(pck_defs)
|
||||||
@ -69,10 +71,10 @@ install-defs: $(pck_defs)
|
|||||||
$(INSTALL_DIR) $(DESTDIR)$(postplugdefsdir)
|
$(INSTALL_DIR) $(DESTDIR)$(postplugdefsdir)
|
||||||
$(INSTALL_DATA) $^ $(DESTDIR)$(postplugdefsdir)/$(PACKAGE).defs
|
$(INSTALL_DATA) $^ $(DESTDIR)$(postplugdefsdir)/$(PACKAGE).defs
|
||||||
|
|
||||||
install-initscript: $(pck_initscript)
|
install-initscript:
|
||||||
@echo "installing initscript...";\
|
@echo "installing initscript...";\
|
||||||
$(INSTALL_DIR) $(DESTDIR)$(initrddir)
|
$(INSTALL_DIR) $(DESTDIR)$(systemdunitdir)
|
||||||
$(INSTALL_SCRIPT) $^ $(DESTDIR)$(initrddir)/$(PACKAGE)
|
$(INSTALL_DATA) postplug/postplug-service $(DESTDIR)$(systemdunitdir)/postplug.service
|
||||||
|
|
||||||
install-logrotate: $(pck_logrotate)
|
install-logrotate: $(pck_logrotate)
|
||||||
@echo "installing logrotate file...";\
|
@echo "installing logrotate file...";\
|
||||||
@ -91,19 +93,25 @@ install-plugins: $(pck_plugins)
|
|||||||
$(DESTDIR)$(postplugrcdir)/$$plugin;\
|
$(DESTDIR)$(postplugrcdir)/$$plugin;\
|
||||||
done
|
done
|
||||||
|
|
||||||
|
install-udev-files:
|
||||||
|
@echo "installing udev files..."
|
||||||
|
@$(INSTALL_DIR) $(DESTDIR)$(udevrulesdir)
|
||||||
|
$(INSTALL_SCRIPT) udev/android_usb $(DESTDIR)$(udevdir)/android_usb
|
||||||
|
$(INSTALL_DATA) udev/76-android_usb.rules $(DESTDIR)$(udevrulesdir)/76-android_usb.rules
|
||||||
|
|
||||||
install-sysconfig: $(pck_sysconfig)
|
install-sysconfig: $(pck_sysconfig)
|
||||||
@$(INSTALL_DIR) $(DESTDIR)$(sysconfigdir)
|
@$(INSTALL_DIR) $(DESTDIR)$(sysconfigdir)
|
||||||
$(INSTALL_DATA) $^ $(DESTDIR)$(sysconfigdir)
|
$(INSTALL_DATA) $^ $(DESTDIR)$(sysconfigdir)
|
||||||
|
|
||||||
install-scripts: $(pck_scripts)
|
install-scripts: $(pck_scripts)
|
||||||
@echo "installing logrotate file...";\
|
@echo "installing logrotate file...";\
|
||||||
$(INSTALL_DIR) $(DESTDIR)$(sbin)
|
$(INSTALL_DIR) $(DESTDIR)$(sbindir)
|
||||||
$(INSTALL_SCRIPT) $^ $(DESTDIR)$(sbin)
|
$(INSTALL_SCRIPT) $^ $(DESTDIR)$(sbindir)
|
||||||
|
|
||||||
install-programs: install-plugins install-scripts install-defs
|
install-programs: install-plugins install-scripts install-defs
|
||||||
@echo "installing $(PACKAGE)..."
|
@echo "installing $(PACKAGE)..."
|
||||||
@$(INSTALL_DIR) $(DESTDIR)$(sbin)
|
@$(INSTALL_DIR) $(DESTDIR)$(sbindir)
|
||||||
$(INSTALL_SCRIPT) $(pck_postplug) $(DESTDIR)$(sbin)/$(PACKAGE)
|
$(INSTALL_SCRIPT) $(pck_postplug) $(DESTDIR)$(sbindir)/$(PACKAGE)
|
||||||
$(INSTALL_DIR) $(DESTDIR)$(postplugnewdir)
|
$(INSTALL_DIR) $(DESTDIR)$(postplugnewdir)
|
||||||
|
|
||||||
install: \
|
install: \
|
||||||
@ -111,17 +119,18 @@ install: \
|
|||||||
install-initscript \
|
install-initscript \
|
||||||
install-logrotate \
|
install-logrotate \
|
||||||
install-locales \
|
install-locales \
|
||||||
install-sysconfig
|
install-sysconfig \
|
||||||
|
install-udev-files
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(sbin)/$(PACKAGE)
|
rm -f $(DESTDIR)$(sbindir)/$(PACKAGE)
|
||||||
for f in $(notdir $(pck_plugins)); do\
|
for f in $(notdir $(pck_plugins)); do\
|
||||||
rm -f $(DESTDIR)$(postplugdir)/$${f##[0-9][0-9]};\
|
rm -f $(DESTDIR)$(postplugdir)/$${f##[0-9][0-9]};\
|
||||||
rm -f $(DESTDIR)$(postplugrcdir)/$$f;\
|
rm -f $(DESTDIR)$(postplugrcdir)/$$f;\
|
||||||
done
|
done
|
||||||
-rmdir $(DESTDIR)$(postplugdir)
|
-rmdir $(DESTDIR)$(postplugdir)
|
||||||
-rmdir $(DESTDIR)$(postplugrcdir)
|
-rmdir $(DESTDIR)$(postplugrcdir)
|
||||||
rm -f $(DESTDIR)$(initrddir)/$(PACKAGE)
|
rm -f $(DESTDIR)$(systemdunitdir)/postplug.service
|
||||||
rm -f $(DESTDIR)$(localesdir)/*/LC_MESSAGES/$(PACKAGE).mo
|
rm -f $(DESTDIR)$(localesdir)/*/LC_MESSAGES/$(PACKAGE).mo
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
|
@ -1,97 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# localtime - localtime plugin for postplug
|
|
||||||
# Copyright (c) 2004-2005 by Silvan Calarco <silvan.calarco@qilinux.it>
|
|
||||||
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
|
||||||
|
|
||||||
[ -e /etc/localtime ] && exit 0
|
|
||||||
|
|
||||||
[ -r /etc/postplug/postplug.defs ] ||
|
|
||||||
{ echo "${0##*/}: error: cannot read postplug.defs" >> $logfile
|
|
||||||
exit 1; }
|
|
||||||
|
|
||||||
. /etc/postplug/postplug.defs
|
|
||||||
|
|
||||||
tmpflt=`mktemp -q -t ${0##*/}.XXXXXXXX` ||
|
|
||||||
{ echo "${0##*/}: error: cannot create temporary files." >&2 >> $logfile
|
|
||||||
{ (exit 1); exit 1; }; }
|
|
||||||
tmpflt2=`mktemp -q -t ${0##*/}.XXXXXXXX` ||
|
|
||||||
{ echo "${0##*/}: error: cannot create temporary files." >&2 >> $logfile
|
|
||||||
{ (exit 1); exit 1; }; }
|
|
||||||
|
|
||||||
trap "rm -f $tmpflt $tmpflt2" 1 2 3 15
|
|
||||||
|
|
||||||
LOCALTIMEFILE=/etc/localtime
|
|
||||||
rootdir="/usr/share/zoneinfo"
|
|
||||||
|
|
||||||
# fixme: the following rootdirs are excluded:
|
|
||||||
# Brazil Canada Chile Mexico Mieast US"
|
|
||||||
rootdirs='
|
|
||||||
Africa
|
|
||||||
America
|
|
||||||
Antarctica
|
|
||||||
Arctic
|
|
||||||
Asia
|
|
||||||
Atlantic
|
|
||||||
Australia
|
|
||||||
Europe
|
|
||||||
Indian
|
|
||||||
Pacific'
|
|
||||||
|
|
||||||
currdir=$rootdir
|
|
||||||
while :; do
|
|
||||||
[ "$currdir" = "$rootdir" ] && unset extrabutton ||
|
|
||||||
extrabutton="--extra-button --extra-label "$"Back"
|
|
||||||
|
|
||||||
cat > $tmpflt2 << _EOF
|
|
||||||
$DIALOG --colors \
|
|
||||||
--cr-wrap --clear \
|
|
||||||
--output-fd 4 \
|
|
||||||
--exit-label _exit $extrabutton --clear \
|
|
||||||
--begin 3 11 \
|
|
||||||
--backtitle "$dialog_backtitle -- "$"Time zone selection" \
|
|
||||||
--title $" TIME ZONE SELECTION " \
|
|
||||||
--menu "
|
|
||||||
"$"Please select the local time zone for this system.""
|
|
||||||
|
|
||||||
"$"Use the \Z1UP\Zn/\Z1DOWN\
|
|
||||||
\Zn arrow keys to scroll through the whole \
|
|
||||||
list of choices." 20 60 9 \\
|
|
||||||
_EOF
|
|
||||||
|
|
||||||
if [ "$currdir" = "$rootdir" ]; then
|
|
||||||
for currzone in $rootdirs; do
|
|
||||||
echo "${currzone##*/} \"\" \\" >> $tmpflt2
|
|
||||||
done
|
|
||||||
else
|
|
||||||
#currlist=`find $currdir/* -maxdepth 0 -type d`
|
|
||||||
for currzone in `find $currdir/* -maxdepth 0 -type f`; do
|
|
||||||
[ -n "`grep "^TZif" $currzone`" ] &&
|
|
||||||
#echo "${currzone##*/} \"$currzone\" \\" >> $tmpflt2
|
|
||||||
echo "${currzone##*/} \"\" \\" >> $tmpflt2
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
echo " 4>$tmpflt" >> $tmpflt2
|
|
||||||
|
|
||||||
[ -w /proc/splash ] && echo "verbose" > /proc/splash
|
|
||||||
|
|
||||||
. $tmpflt2
|
|
||||||
retval=$?
|
|
||||||
|
|
||||||
rm -f $tmpflt2
|
|
||||||
|
|
||||||
case $retval in
|
|
||||||
0) choice="`cat $tmpflt`"
|
|
||||||
[ $choice = "_exit" ] && clear && exit 1
|
|
||||||
currdir="$currdir/$choice"
|
|
||||||
|
|
||||||
if [ ! -d $currdir ]; then
|
|
||||||
cp $currdir $LOCALTIMEFILE
|
|
||||||
echo "$currdir" > /etc/timezone
|
|
||||||
sed -i "s|$rootdir/||" /etc/timezone
|
|
||||||
clear
|
|
||||||
exit 0
|
|
||||||
fi ;;
|
|
||||||
3) currdir=${currdir%\/*} ;;
|
|
||||||
*) clear; exit 1 ;;
|
|
||||||
esac
|
|
||||||
done
|
|
@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# video - video configuration plugin for postplug
|
|
||||||
# Copyright (c) 2008 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
||||||
#
|
|
||||||
XORG_MONITOR_FILE=/var/lib/postplug/xorg.conf.monitor
|
|
||||||
tmpfile=`mktemp -q`
|
|
||||||
/usr/sbin/get-edid 2>/dev/null | /usr/sbin/parse-edid 2>/dev/null >$tmpfile
|
|
||||||
|
|
||||||
[ $? -eq 0 ] && cp $tmpfile $XORG_MONITOR_FILE
|
|
||||||
rm -f $tmpfile
|
|
||||||
exit 0
|
|
14
po/es.po
14
po/es.po
@ -4,6 +4,20 @@
|
|||||||
|
|
||||||
#: postplug
|
#: postplug
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: 1.90\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2022-06-19 12:53+0200\n"
|
||||||
|
"PO-Revision-Date: 2011-04-26 18:37+CEST\n"
|
||||||
|
"Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Generated-By: pygettext.py 1.5\n"
|
||||||
|
|
||||||
#
|
#
|
||||||
# initscript
|
# initscript
|
||||||
#
|
#
|
||||||
|
14
po/it.po
14
po/it.po
@ -4,6 +4,20 @@
|
|||||||
|
|
||||||
#: postplug
|
#: postplug
|
||||||
|
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: 1.90\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2022-06-19 12:53+0200\n"
|
||||||
|
"PO-Revision-Date: 2011-04-26 18:37+CEST\n"
|
||||||
|
"Last-Translator: Silvan Calarco <silvan.calarco@mambasot.it>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Generated-By: pygettext.py 1.5\n"
|
||||||
|
|
||||||
#
|
#
|
||||||
# localtime plugin
|
# localtime plugin
|
||||||
#
|
#
|
||||||
|
@ -11,7 +11,7 @@ function getdmivar() {
|
|||||||
local dmivalue
|
local dmivalue
|
||||||
[ $1 ] || return 0
|
[ $1 ] || return 0
|
||||||
|
|
||||||
dmivalue=`/usr/sbin/dmidecode -s $1 2>/dev/null | head -n1`
|
dmivalue=`/usr/sbin/dmidecode -s $1 2>/dev/null | grep -v "^#" | head -n1`
|
||||||
echo $dmivalue
|
echo $dmivalue
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -7,30 +7,24 @@
|
|||||||
|
|
||||||
[ -e /etc/sysconfig/acpi ] && . /etc/sysconfig/acpi
|
[ -e /etc/sysconfig/acpi ] && . /etc/sysconfig/acpi
|
||||||
|
|
||||||
[ "$CPU_FREQ" = "" ] && {
|
[ "$CPU_FREQ" ] && exit 0
|
||||||
|
|
||||||
CPUMODEL=`cat /proc/cpuinfo | grep "model name" -m1 | sed "s|model name[[:space:]*]:\(.*\)|\1|" `
|
CPUMODEL=`cat /proc/cpuinfo | grep "model name" -m1 | sed "s|model name[[:space:]*]:\(.*\)|\1|" `
|
||||||
|
|
||||||
if [ "`echo $CPUMODEL | grep AMD`" ]; then
|
if [ "`echo $CPUMODEL | grep AMD`" ]; then
|
||||||
|
CPUVENDOR=AMD
|
||||||
CPUVENDOR=AMD
|
if [ "`echo $CPUMODEL | grep X2`" ]; then
|
||||||
if [ "`echo $CPUMODEL | grep X2`" ]; then
|
LOAD_MODULE=powernow_k8
|
||||||
LOAD_MODULE=powernow_k8
|
elif [ "`echo $CPUMODEL | grep Athlon`" ]; then
|
||||||
elif [ "`echo $CPUMODEL | grep Athlon`" ]; then
|
LOAD_MODULE=k8temp
|
||||||
LOAD_MODULE=k8temp
|
elif [ "`echo $CPUMODEL | grep Thurion`" ]; then
|
||||||
elif [ "`echo $CPUMODEL | grep Thurion`" ]; then
|
LOAD_MODULE=k8temp
|
||||||
LOAD_MODULE=k8temp
|
else
|
||||||
else
|
|
||||||
LOAD_MODULE=acpi_cpufreq
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ "`echo $CPUMODEL | grep Intel`" ]; then
|
|
||||||
|
|
||||||
CPUVENDOR=Intel
|
|
||||||
LOAD_MODULE=acpi_cpufreq
|
LOAD_MODULE=acpi_cpufreq
|
||||||
fi
|
fi
|
||||||
|
elif [ "`echo $CPUMODEL | grep Intel`" ]; then
|
||||||
[ -e /etc/sysconfig/acpi ] && sed -i "/CPU_FREQ=.*/d" /etc/sysconfig/acpi
|
CPUVENDOR=Intel
|
||||||
echo "CPU_FREQ=$LOAD_MODULE" >> /etc/sysconfig/acpi
|
LOAD_MODULE=acpi_cpufreq
|
||||||
|
fi
|
||||||
}
|
[ -e /etc/sysconfig/acpi ] && sed -i "/CPU_FREQ=.*/d" /etc/sysconfig/acpi
|
||||||
|
echo "CPU_FREQ=$LOAD_MODULE" >> /etc/sysconfig/acpi
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# filesystems - filesystems plugin for postplug
|
# filesystems - filesystems plugin for postplug
|
||||||
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
||||||
# Copyright (c) 2007 by Stefano Cotta Ramusino <stefano.cotta@openmamba.org>
|
# Copyright (c) 2007 by Stefano Cotta Ramusino <stefano.cotta@openmamba.org>
|
||||||
# Copyright (c) 2009-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (c) 2009-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
|
||||||
if [ $UID != 0 ]; then
|
if [ $UID != 0 ]; then
|
||||||
echo "$0: must be superuser." >&2
|
echo "$0: must be superuser." >&2
|
||||||
@ -72,6 +72,10 @@ ${dir/[0-9]*/}$((${dir/$mp_suffix/}+1))" ;;
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ -d /run/systemd ]; then
|
||||||
|
# With systemd only manage swap and disable everything else
|
||||||
|
unset FS_FLOPPY_UPDATE FS_CDROM_UPDATE FS_VFS_UPDATE FS_NODEV_REMOVE FS_PARTS_UPDATE FS_PARTS_MOUNT
|
||||||
|
fi
|
||||||
|
|
||||||
tmpfstab=`mktemp -q -t $me.XXXXXXXX` ||
|
tmpfstab=`mktemp -q -t $me.XXXXXXXX` ||
|
||||||
{ logmsg "$me" $"error: "$"cannot create temporary files"
|
{ logmsg "$me" $"error: "$"cannot create temporary files"
|
||||||
@ -86,7 +90,7 @@ trap "rm -f $tmpfstab" 0 1 2 5 15
|
|||||||
# -name cdrecording -o -name cdrecording[0-9]\* \
|
# -name cdrecording -o -name cdrecording[0-9]\* \
|
||||||
#\) -print | xargs rmdir 2>/dev/null
|
#\) -print | xargs rmdir 2>/dev/null
|
||||||
|
|
||||||
if [ "$FS_VFS_UPDATE" != no ]; then
|
if [ "$FS_VFS_UPDATE" = "yes" ]; then
|
||||||
# note: '[ \t]\+/proc[ \t]\+' does not work :(
|
# note: '[ \t]\+/proc[ \t]\+' does not work :(
|
||||||
grep -q "/proc" $fstab 2>/dev/null ||
|
grep -q "/proc" $fstab 2>/dev/null ||
|
||||||
{ echo "proc /proc proc defaults 0 0" >> $fstab
|
{ echo "proc /proc proc defaults 0 0" >> $fstab
|
||||||
@ -121,7 +125,7 @@ if [ "$FS_VFS_UPDATE" != no ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$FS_NO_DEV_REMOVE" = yes ]; then
|
if [ "$FS_NO_DEV_REMOVE" = "yes" ]; then
|
||||||
[ -e $fstab ] && cp $fstab $tmpfstab || touch $fstab
|
[ -e $fstab ] && cp $fstab $tmpfstab || touch $fstab
|
||||||
while read fs mount_point fstype options dump fsck_order ignore; do
|
while read fs mount_point fstype options dump fsck_order ignore; do
|
||||||
case $fs in
|
case $fs in
|
||||||
@ -160,12 +164,14 @@ let "swapon = 0"
|
|||||||
# scan for new devices using the searching mask `$devs2scan'
|
# scan for new devices using the searching mask `$devs2scan'
|
||||||
[[ "$FS_PARTS_MOUNT" = "yes" ]] && AUTO_ADD="" || AUTO_ADD="noauto,"
|
[[ "$FS_PARTS_MOUNT" = "yes" ]] && AUTO_ADD="" || AUTO_ADD="noauto,"
|
||||||
|
|
||||||
[[ "$FS_PARTS_UPDATE" = no && "$FS_SWAP_UPDATE" = no ]] ||
|
# disable automounting of swap partition if live to fix Calamares installation
|
||||||
blkid | grep /dev/sd | while read line; do
|
[ -e /run/overlayfs ] && FS_SWAP_UPDATE="no"
|
||||||
|
|
||||||
|
[[ "$FS_PARTS_UPDATE" != "yes" && "$FS_SWAP_UPDATE" != "yes" ]] ||
|
||||||
|
blkid | while read line; do
|
||||||
unset dev uuid devline devfstype TYPE UUID LABEL
|
unset dev uuid devline devfstype TYPE UUID LABEL
|
||||||
dev=${line/:*}
|
dev=${line/: *}
|
||||||
devline=${line/*:}
|
devline=${line/*: }
|
||||||
eval $devline
|
eval $devline
|
||||||
label=$LABEL
|
label=$LABEL
|
||||||
devfstype=$TYPE
|
devfstype=$TYPE
|
||||||
@ -191,11 +197,13 @@ blkid | grep /dev/sd | while read line; do
|
|||||||
check_options="0 0"
|
check_options="0 0"
|
||||||
case $dev in
|
case $dev in
|
||||||
/dev/fd[0-9]*|/dev/floppy/[0-9]) # floppy disk drives
|
/dev/fd[0-9]*|/dev/floppy/[0-9]) # floppy disk drives
|
||||||
[ "$FS_FLOPPY_UPDATE" = yes ] || continue
|
[ "$FS_FLOPPY_UPDATE" = "yes" ] || continue
|
||||||
mount_point=$(get_new_mp_name floppy)
|
mount_point=$(get_new_mp_name floppy)
|
||||||
;;
|
;;
|
||||||
/dev/cdrom[0-9]*) # CDROM devices
|
/dev/sr[0-9]*|\
|
||||||
[ "$FS_CDROM_UPDATE" = yes ] || continue
|
/dev/cdrom[0-9]*)
|
||||||
|
# CDROM devices
|
||||||
|
[ "$FS_CDROM_UPDATE" = "yes" ] || continue
|
||||||
# check if the CD is already mounted
|
# check if the CD is already mounted
|
||||||
devfs="$(readlink -f $dev)"
|
devfs="$(readlink -f $dev)"
|
||||||
mount | \
|
mount | \
|
||||||
@ -210,7 +218,9 @@ blkid | grep /dev/sd | while read line; do
|
|||||||
mount_point=$(get_new_mp_name cdrom)
|
mount_point=$(get_new_mp_name cdrom)
|
||||||
;;
|
;;
|
||||||
/dev/sd[a-z][0-9]*|\
|
/dev/sd[a-z][0-9]*|\
|
||||||
|
/dev/vd[a-z][0-9]*|\
|
||||||
/dev/hd[a-z][0-9]*|\
|
/dev/hd[a-z][0-9]*|\
|
||||||
|
/dev/mmcblk[0-9]*p[0-9]*|\
|
||||||
/dev/ub[a-z][0-9]*|\
|
/dev/ub[a-z][0-9]*|\
|
||||||
/dev/ub/[a-z]*/part[0-9]*)
|
/dev/ub/[a-z]*/part[0-9]*)
|
||||||
## if an USB device is detected add the 'sync' option
|
## if an USB device is detected add the 'sync' option
|
||||||
@ -230,13 +240,13 @@ blkid | grep /dev/sd | while read line; do
|
|||||||
# s/\([^ ]*[ ]*\)\{4\}\([^ ]*\).*/\2/p}" )
|
# s/\([^ ]*[ ]*\)\{4\}\([^ ]*\).*/\2/p}" )
|
||||||
case $devfstype in
|
case $devfstype in
|
||||||
linux-swap|swap) # Linux swap
|
linux-swap|swap) # Linux swap
|
||||||
[ "$FS_SWAP_UPDATE" = yes ] || continue
|
[ "$FS_SWAP_UPDATE" = "yes" ] || continue
|
||||||
mount_point="swap "
|
mount_point="swap "
|
||||||
fstype="swap"
|
fstype="swap"
|
||||||
options="pri=1"
|
options="pri=1,nofail,x-systemd.device-timeout=4"
|
||||||
let "swapon = 1" ;;
|
let "swapon = 1" ;;
|
||||||
ext*|reiserfs|reiser4) # Linux partition
|
ext*|reiserfs|reiser4) # Linux partition
|
||||||
[ "$FS_PARTS_UPDATE" = yes ] || continue
|
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
|
||||||
mount_point=$(get_new_mp_name "$label" $dev)
|
mount_point=$(get_new_mp_name "$label" $dev)
|
||||||
if [[ "$mount_point" = "/" ]]; then
|
if [[ "$mount_point" = "/" ]]; then
|
||||||
# found a root partition already mounted but not in fstab!
|
# found a root partition already mounted but not in fstab!
|
||||||
@ -248,7 +258,7 @@ blkid | grep /dev/sd | while read line; do
|
|||||||
fi
|
fi
|
||||||
options="defaults,noatime" ;;
|
options="defaults,noatime" ;;
|
||||||
ntfs|hpfs) # HPFS/NTFS
|
ntfs|hpfs) # HPFS/NTFS
|
||||||
[ "$FS_PARTS_UPDATE" = yes ] || continue
|
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
|
||||||
mount_point=$(get_new_mp_name "$label" $dev)
|
mount_point=$(get_new_mp_name "$label" $dev)
|
||||||
if [ -x /sbin/mount.ntfs-3g ]; then
|
if [ -x /sbin/mount.ntfs-3g ]; then
|
||||||
fstype="ntfs-3g"
|
fstype="ntfs-3g"
|
||||||
@ -258,17 +268,17 @@ blkid | grep /dev/sd | while read line; do
|
|||||||
options="${AUTO_ADD}user,ro,gid=32,umask=002"
|
options="${AUTO_ADD}user,ro,gid=32,umask=002"
|
||||||
fi ;;
|
fi ;;
|
||||||
fat12|fat16|fat32|FAT|vfat)
|
fat12|fat16|fat32|FAT|vfat)
|
||||||
[ "$FS_PARTS_UPDATE" = yes ] || continue
|
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
|
||||||
# FAT12, FAT16<32M, FAT16, FAT16 [LBA]
|
# FAT12, FAT16<32M, FAT16, FAT16 [LBA]
|
||||||
# FAT32 [LBA]
|
# FAT32 [LBA]
|
||||||
mount_point=$(get_new_mp_name "$label" $dev)
|
mount_point=$(get_new_mp_name "$label" $dev)
|
||||||
options="${AUTO_ADD}user,gid=32,umask=002" ;;
|
options="${AUTO_ADD}user,gid=32,umask=002" ;;
|
||||||
hfs|hfs+|hfsplus)
|
hfs|hfs+|hfsplus)
|
||||||
[ "$FS_PARTS_UPDATE" = yes ] || continue
|
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
|
||||||
mount_point=$(get_new_mp_name "$label" $dev)
|
mount_point=$(get_new_mp_name "$label" $dev)
|
||||||
options="${AUTO_ADD}user" ;;
|
options="${AUTO_ADD}user" ;;
|
||||||
# f) # W95 Ext'd (LBA)
|
# f) # W95 Ext'd (LBA)
|
||||||
# [ "$FS_PARTS_UPDATE" = yes ] || continue
|
# [ "$FS_PARTS_UPDATE" = "yes" ] || continue
|
||||||
# unset nblocks
|
# unset nblocks
|
||||||
# nblocks=$( echo $(grep ${dev/\/dev\//} /proc/partitions) | \
|
# nblocks=$( echo $(grep ${dev/\/dev\//} /proc/partitions) | \
|
||||||
# cut -d" " -f3 )
|
# cut -d" " -f3 )
|
||||||
@ -276,7 +286,7 @@ blkid | grep /dev/sd | while read line; do
|
|||||||
# mount_point=$(get_new_mp_name "$label")
|
# mount_point=$(get_new_mp_name "$label")
|
||||||
# options="${AUTO_ADD}user,gid=32,umask=002" ;;
|
# options="${AUTO_ADD}user,gid=32,umask=002" ;;
|
||||||
*) # ignore unknown partitions
|
*) # ignore unknown partitions
|
||||||
[ "$FS_PARTS_UPDATE" = yes ] || continue
|
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
|
||||||
logmsg "$me" $"ignoring unknown partition (id:$devfstype)"
|
logmsg "$me" $"ignoring unknown partition (id:$devfstype)"
|
||||||
continue ;;
|
continue ;;
|
||||||
esac
|
esac
|
||||||
@ -285,9 +295,6 @@ blkid | grep /dev/sd | while read line; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
logmsg "$me" $"\
|
|
||||||
added device \`$dev' (${uuid}) mount point:\`$mount_point'"
|
|
||||||
|
|
||||||
# note: if 'mount_point' is yet undefined there is a bug
|
# note: if 'mount_point' is yet undefined there is a bug
|
||||||
if [[ "$mount_point" ]]; then
|
if [[ "$mount_point" ]]; then
|
||||||
# default values: fstype="auto", options="noauto,user"
|
# default values: fstype="auto", options="noauto,user"
|
||||||
@ -296,25 +303,27 @@ added device \`$dev' (${uuid}) mount point:\`$mount_point'"
|
|||||||
echo "\
|
echo "\
|
||||||
UUID=${uuid} $mount_point \
|
UUID=${uuid} $mount_point \
|
||||||
${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab
|
${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab
|
||||||
|
[ "$fstype" = "swap" ] && /sbin/swapon -p 1 UUID=${uuid}
|
||||||
else
|
else
|
||||||
echo "\
|
echo "\
|
||||||
$dev $mount_point \
|
$dev $mount_point \
|
||||||
${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab
|
${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab
|
||||||
|
[ "$fstype" = "swap" ] && /sbin/swapon -p 1 ${dev}
|
||||||
fi
|
fi
|
||||||
# create the mount point and mount the new device
|
# create the mount point and mount the new device
|
||||||
[ "${mount_point:0:${#rootmp}}" = "${rootmp}" ] && {
|
[ "${mount_point:0:${#rootmp}}" = "${rootmp}" ] && {
|
||||||
mkdir -p "$mount_point"
|
mkdir -p "$mount_point"
|
||||||
mount "$mount_point"
|
mount "$mount_point"
|
||||||
}
|
}
|
||||||
|
logmsg "$me" $"\
|
||||||
|
added device \`$dev' (${uuid}) mount point:\`$mount_point'"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
grep "[[:space:]]/[[:space:]].*ext[2-9].*defaults[[:space:]]" /etc/fstab >/dev/null && {
|
grep "[[:space:]]/[[:space:]].*ext[2-9].*defaults,noatime[[:space:]]" /etc/fstab >/dev/null && {
|
||||||
logmsg "$me" $"enabling \`noatime' option for root filesystem"
|
logmsg "$me" $"disabling \`noatime' option for root filesystem (previously added by postplug)"
|
||||||
sed -i "s|\([[:space:]]/[[:space:]].*ext[2-9].*defaults\)\([[:space:]]\)|\1,noatime\2|" /etc/fstab
|
sed -i "s|\([[:space:]]/[[:space:]].*ext[2-9].*defaults\),noatime|\1|" /etc/fstab
|
||||||
mount -o remount /
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "$swapon" = 1 ] && swapon -a
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# loadconf - postplug plugin: restore the QiLinux Live system/user configuration
|
|
||||||
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
|
||||||
|
|
||||||
if [ $UID != 0 ]; then
|
|
||||||
echo "$0: must be superuser." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# FIXME: add translation
|
|
||||||
|
|
||||||
me="loadconf"
|
|
||||||
|
|
||||||
. /etc/postplug/postplug.defs
|
|
||||||
|
|
||||||
#qitarget="$(LANG=C cat /etc/qilinux-release |
|
|
||||||
# sed "s,[ ]*release.*,,;s, ,-,")"
|
|
||||||
#qiver="$(LANG=C cat /etc/qilinux-release |
|
|
||||||
# sed "s,.*release[ ]*\([^ ]*\)[ ]*for.*,\1,")"
|
|
||||||
#qiconf="$qitarget-$qiver-saveconf.tar.bz2"
|
|
||||||
|
|
||||||
qiconf="QiLinux-live-saveconf.tar.bz2"
|
|
||||||
|
|
||||||
grep "^/" /etc/fstab | \
|
|
||||||
while read dev mountpoint skip; do
|
|
||||||
case "$mountpoint" in
|
|
||||||
/mnt/cdrom*|swap) ;;
|
|
||||||
*) mount | grep "$dev" &>/dev/null
|
|
||||||
let "res = $?" # 0: mounted; 1: not mounted
|
|
||||||
[ "$res" = 1 ] && mount $mountpoint 2>>$logfile
|
|
||||||
if [ -e $mountpoint/$qiconf ]; then
|
|
||||||
# temporary disable bootsplash
|
|
||||||
[ -w /proc/splash ] && echo "verbose" > /proc/splash
|
|
||||||
|
|
||||||
$DIALOG --clear --colors \
|
|
||||||
--backtitle "\
|
|
||||||
$dialog_backtitle -- "$"Restore QiLinux configuration" \
|
|
||||||
--title $" RESTORE QILINUX CONFIGURATION " \
|
|
||||||
--yesno "
|
|
||||||
"$"Do you want to restore the configuration saved on ""
|
|
||||||
""\Z4$dev\Zn ?" 8 56
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
/usr/sbin/livecd-restore $mountpoint >>$logfile 2>&1
|
|
||||||
[ "$res" = 1 ] && umount $mountpoint 2>>$logfile
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
[ "$res" = 1 ] && umount $mountpoint 2>>$logfile ;;
|
|
||||||
esac
|
|
||||||
done
|
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# localtime - localtime plugin for postplug
|
# localtime - localtime plugin for postplug
|
||||||
# Copyright (c) 2004-2005 by Silvan Calarco <silvan.calarco@qilinux.it>
|
# Copyright (c) 2004-2013 by Silvan Calarco <silvan.calarco@qilinux.it>
|
||||||
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
||||||
|
|
||||||
if [ $UID != 0 ]; then
|
if [ $UID != 0 ]; then
|
||||||
@ -8,7 +8,7 @@ if [ $UID != 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -f /etc/localtime ] && exit 0
|
[ -e /etc/localtime ] && exit 0
|
||||||
|
|
||||||
me="localtime"
|
me="localtime"
|
||||||
|
|
||||||
@ -21,12 +21,16 @@ logmsg "$me" $"creating /etc/timezone and /etc/localtime files..."
|
|||||||
|
|
||||||
# FIXME
|
# FIXME
|
||||||
case "$LANG" in
|
case "$LANG" in
|
||||||
|
es_*)
|
||||||
|
echo "Europe/Madrid" > /etc/timezone
|
||||||
|
ln -sf $ZONEINFODIR/Europe/Madrid /etc/localtime
|
||||||
|
;;
|
||||||
it_*)
|
it_*)
|
||||||
echo "Europe/Rome" > /etc/timezone
|
echo "Europe/Rome" > /etc/timezone
|
||||||
cp -f $ZONEINFODIR/Europe/Rome /etc/localtime
|
ln -sf $ZONEINFODIR/Europe/Rome /etc/localtime
|
||||||
;;
|
;;
|
||||||
*) echo "GMT" > /etc/timezone
|
*) echo "GMT" > /etc/timezone
|
||||||
cp -f $ZONEINFODIR/GMT /etc/localtime
|
ln -sf $ZONEINFODIR/GMT /etc/localtime
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# network - network plugin for postplug
|
# network - network plugin for postplug
|
||||||
#
|
#
|
||||||
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
||||||
# Copyright (c) 2009-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (c) 2009-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ $UID != 0 ]; then
|
if [ $UID != 0 ]; then
|
||||||
@ -15,9 +15,6 @@ me="network"
|
|||||||
|
|
||||||
. /etc/postplug/postplug.defs
|
. /etc/postplug/postplug.defs
|
||||||
|
|
||||||
postplugnew_file=$postplugnewdir/network
|
|
||||||
rm -f $postplugnew_file
|
|
||||||
|
|
||||||
[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug
|
[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug
|
||||||
|
|
||||||
[ -r /etc/sysconfig/rc ] && . /etc/sysconfig/rc
|
[ -r /etc/sysconfig/rc ] && . /etc/sysconfig/rc
|
||||||
@ -57,323 +54,162 @@ _EOF
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cdc_usb() {
|
||||||
|
local CDC_IPADDR=10.99.99.1
|
||||||
|
local CDC_SUBNET=10.99.99.0
|
||||||
|
local CDC_RANGE_FROM=10.99.99.100
|
||||||
|
local CDC_RANGE_TO=10.99.99.199
|
||||||
|
local CDC_NETMASK=255.255.255.0
|
||||||
|
|
||||||
function eth_config() {
|
ifconfig usb0 &>/dev/null && {
|
||||||
# eth_config {--enable|--disable|--auto} <int_name>
|
[ "$NETWORK_CDC_NETMASK" ] && CDC_NETMASK=$NETWORK_CDC_NETMASK
|
||||||
|
[ -e $network_devices/ifcfg-usb0 ] || {
|
||||||
|
[ "$NETWORK_CDC_IPADDR" ] && CDC_IPADDR=$NETWORK_CDC_IPADDR
|
||||||
|
cat > $network_devices/ifcfg-usb0 << _EOF
|
||||||
|
DEVICE=usb0
|
||||||
|
BOOTPROTO=none
|
||||||
|
IPADDR=$CDC_IPADDR
|
||||||
|
NETMASK=$CDC_NETMASK
|
||||||
|
ONBOOT=yes
|
||||||
|
NM_CONTROLLED=no
|
||||||
|
_EOF
|
||||||
|
}
|
||||||
|
[ -e /etc/dhcpd-usb0.conf ] || {
|
||||||
|
[ "$NETWORK_CDC_SUBNET" ] && CDC_SUBNET=$NETWORK_CDC_SUBNET
|
||||||
|
[ "$NETWORK_CDC_RANGE_FROM" ] && CDC_RANGE_FROM=$NETWORK_CDC_RANGE_FROM
|
||||||
|
[ "$NETWORK_CDC_RANGE_TO" ] && CDC_RANGE_TO=$NETWORK_CDC_RANGE_TO
|
||||||
|
cat > /etc/dhcpd-usb0.conf << _EOF
|
||||||
|
# Created by postplug
|
||||||
|
subnet $NETWORK_CDC_SUBNET netmask $NETWORK_CDC_NETMASK {
|
||||||
|
range dynamic-bootp $NETWORK_CDC_RANGE_FROM $NETWORK_CDC_RANGE_TO;
|
||||||
|
}
|
||||||
|
_EOF
|
||||||
|
}
|
||||||
|
ifup usb0
|
||||||
|
touch /var/lib/dhcp/dhcpd-usb0.leases
|
||||||
|
/sbin/dhcpd -q usb0 -pf /run/dhcpd-usb0.pid -cf /etc/dhcpd-usb0.conf -lf /var/lib/dhcp/dhcpd-usb0.leases
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEMP=`LANG=C getopt -o eda --long enable,disable,auto -n "$FUNCNAME" -- "$@"`
|
function android_usb() {
|
||||||
[[ $? = 0 ]] || return 1
|
local ANDROID_IPADDR=10.99.99.1
|
||||||
|
local ANDROID_ETHADDR=80:00:60:0F:E8:00
|
||||||
|
local ANDROID_SUBNET=10.99.99.0
|
||||||
|
local ANDROID_RANGE_FROM=10.99.99.100
|
||||||
|
local ANDROID_RANGE_TO=10.99.99.199
|
||||||
|
local ANDROID_NETMASK=255.255.255.0
|
||||||
|
|
||||||
eval set -- "$TEMP"
|
# FIXME: hardcoded values
|
||||||
|
if [ -e /sys/class/android_usb/android0 ]; then
|
||||||
|
[ "$NETWORK_ANDROID_ETHADDR" ] && ANDROID_ETHADDR=$NETWORK_ANDROID_ETHADDR
|
||||||
|
[ "$NETWORK_ANDORID_NETMASK" ] && ANDORID_NETMASK=$NETWORK_ANDORID_NETMASK
|
||||||
|
echo 0 > /sys/class/android_usb/android0/enable
|
||||||
|
echo rndis,acm > /sys/class/android_usb/android0/functions
|
||||||
|
echo 2 > /sys/class/android_usb/android0/f_acm/instances
|
||||||
|
echo $ANDROID_ETHADDR > /sys/class/android_usb/android0/f_rndis/ethaddr
|
||||||
|
echo 2d01 > /sys/class/android_usb/android0/idProduct
|
||||||
|
echo 1 > /sys/class/android_usb/android0/enable
|
||||||
|
|
||||||
local action
|
[ -e $network_devices/ifcfg-rndis0 ] || {
|
||||||
while :; do
|
[ "$NETWORK_ANDROID_IPADDR" ] && ANDROID_IPADDR=$NETWORK_ANDROID_IPADDR
|
||||||
case $1 in
|
cat > $network_devices/ifcfg-rndis0 << _EOF
|
||||||
-e|--enable)
|
DEVICE=rndis0
|
||||||
action="enable" ;;
|
BOOTPROTO=none
|
||||||
-d|--disable)
|
IPADDR=$ANDROID_IPADDR
|
||||||
action="disable" ;;
|
NETMASK=$ANDROID_NETMASK
|
||||||
-a|--auto)
|
ONBOOT=yes
|
||||||
action="auto" ;;
|
NM_CONTROLLED=no
|
||||||
--) shift; break ;;
|
_EOF
|
||||||
*) logmsg "$me" "FIXME: "$"\`getopt' error"
|
}
|
||||||
|
|
||||||
|
[ -e /etc/dhcpd-rndis0.conf ] || {
|
||||||
|
[ "$NETWORK_ANDROID_SUBNET" ] && ANDROID_SUBNET=$NETWORK_ANDROID_SUBNET
|
||||||
|
[ "$NETWORK_ANDROID_RANGE_FROM" ] && ANDORID_RANGE_FROM=$NETWORK_ANDROID_RANGE_FROM
|
||||||
|
[ "$NETWORK_ANDROID_RANGE_TO" ] && ANDROID_RANGE_TO=$NETWORK_ANDROID_RANGE_TO
|
||||||
|
cat > /etc/dhcpd-rndis0.conf << _EOF
|
||||||
|
# Created by postplug
|
||||||
|
subnet $ANDROID_SUBNET netmask $ANDROID_NETMASK {
|
||||||
|
range dynamic-bootp $ANDROID_RANGE_FROM $ANDROID_RANGE_TO;
|
||||||
|
}
|
||||||
|
_EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
for d in ttyGS0 ttyGS1; do
|
||||||
|
[ -e /etc/systemd/system/getty.target.wants/getty@$d.service ] ||
|
||||||
|
ln -s /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@$d.service
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$NETWORK_CDC_DISABLE" = "1" ] || cdc_usb
|
||||||
|
[ "$NETWORK_ANDROID_DISABLE" = "1" ] || android_usb
|
||||||
|
|
||||||
|
# Disable p2p interface managed by NetworkManager
|
||||||
|
for net_int in $(cat /proc/net/dev | sed -n '/p2p[0-9]*:/{s,:.*,,;p}'); do
|
||||||
|
# found interface already configured
|
||||||
|
[ -e $network_devices/ifcfg-${net_int} ] && continue
|
||||||
|
|
||||||
|
if [ "${net_int:0:3}" = "p2p" ]; then
|
||||||
|
P2P_HWADDR=`ifconfig $net_int | grep HWaddr | sed "s|.* HWaddr ||"`
|
||||||
|
cat > $network_devices/ifcfg-${net_int} << _EOF
|
||||||
|
DEVICE=$net_int
|
||||||
|
HWADDR=${P2P_HWADDR:0:17}
|
||||||
|
ONBOOT=no
|
||||||
|
NM_CONTROLLED=no
|
||||||
|
_EOF
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# INFO: the following code is going obsolete
|
||||||
|
if [ "$NETWORK_NEWDEVICE" -a "$NETWORK_NEWDEVICE" != "off" ]; then
|
||||||
|
|
||||||
|
wlan_ints=()
|
||||||
|
for wlan_int in $(cat /proc/net/wireless 2>/dev/null | sed -n '/[a-z]*[0-9]*:/{s,:.*,,;p}'); do
|
||||||
|
# found interface already configured
|
||||||
|
[ -e $network_devices/ifcfg-$wlan_int ] && continue
|
||||||
|
wlan_ints[${#wlan_ints[*]}]="$wlan_int"
|
||||||
|
done
|
||||||
|
|
||||||
|
eth_ints=()
|
||||||
|
for eth_int in $(cat /proc/net/dev | sed -n '/eth[0-9]*:/{s,:.*,,;p}'); do
|
||||||
|
# found interface already configured
|
||||||
|
[ -e $network_devices/ifcfg-$eth_int ] && continue
|
||||||
|
eth_ints[${#eth_ints[*]}]="$eth_int"
|
||||||
|
done
|
||||||
|
|
||||||
|
# how many interface have been configured?
|
||||||
|
let "int_newconf = 0"
|
||||||
|
|
||||||
|
if [ ${#eth_ints[*]} -gt 0 ]; then
|
||||||
|
case "$NETWORK_NEWDEVICE" in
|
||||||
|
"auto")
|
||||||
|
for eth_int in ${eth_ints[*]}; do
|
||||||
|
eth_config_auto $eth_int
|
||||||
|
let "int_newconf += 1"
|
||||||
|
done
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
"off"|"")
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
*) logmsg "$me" "error: "$"\
|
||||||
|
illegal value for NETWORK_NEWDEVICE ($NETWORK_NEWDEVICE)"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
local eth_interface="$1"
|
|
||||||
|
|
||||||
[ "$eth_interface" ] ||
|
|
||||||
{ logmsg "$me" "FIXME: "$"no interface set"
|
|
||||||
exit 1; }
|
|
||||||
|
|
||||||
unset IF_IPADDR IF_NETMASK IF_NETWORK IF_BROADCAST DEST_GATEWAY_IF
|
|
||||||
|
|
||||||
if [ "$action" = "disable" ]; then
|
|
||||||
cat > $network_devices/ifcfg-${eth_interface} << _EOF
|
|
||||||
DEVICE=${eth_interface}
|
|
||||||
ONBOOT=no
|
|
||||||
_EOF
|
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$DIALOG --colors \
|
if [ ${#wlan_ints[*]} -gt 0 ]; then
|
||||||
--backtitle "\
|
case "$NETWORK_NEWDEVICE" in
|
||||||
$dialog_backtitle -- "$"Network devices configuration" \
|
"auto")
|
||||||
--title $" LAN INTERFACE CONFIGURATION " \
|
for wlan_int in ${wlan_ints[*]}; do
|
||||||
--yesno "
|
wlan_config_auto $wlan_int
|
||||||
"$"Automatically configure (DHCP) the \Z4$2\Zn interface?" 7 62
|
|
||||||
|
|
||||||
# configure DHCP for this interface
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
cat > $network_devices/ifcfg-${eth_interface} << _EOF
|
|
||||||
DEVICE=${eth_interface}
|
|
||||||
BOOTPROTO=dhcp
|
|
||||||
ZONE=local
|
|
||||||
ONBOOT=yes
|
|
||||||
_EOF
|
|
||||||
else # no DHCP. Ask for manual configuration
|
|
||||||
while :; do
|
|
||||||
$DIALOG --colors \
|
|
||||||
--output-fd 4 \
|
|
||||||
--ok-label "OK" --no-cancel \
|
|
||||||
--backtitle "\
|
|
||||||
$dialog_backtitle -- "$"Network interface configuration" \
|
|
||||||
--title $" LAN INTERFACE CONFIGURATION ""(${eth_interface}) " \
|
|
||||||
--form "
|
|
||||||
"$"Please enter configuration for network interface" 10 54 2 \
|
|
||||||
$"IP address:" 1 1 "$IF_IPADDR" 1 18 30 15 \
|
|
||||||
$"Netmask:" 2 1 "$IF_NETMASK" 2 18 30 15 4>$tmpdialog
|
|
||||||
|
|
||||||
# workaround to correctly process blank field
|
|
||||||
local field icount=0
|
|
||||||
for field in $(sed 's/^/=/g' $tmpdialog); do
|
|
||||||
field=$(echo $field | sed 's/^=//')
|
|
||||||
case $icount in
|
|
||||||
0) IF_IPADDR="$field" ;;
|
|
||||||
1) IF_NETMASK="$field" ;;
|
|
||||||
esac
|
|
||||||
let icount+=1
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -n "$IF_IPADDR" && -n "$IF_NETMASK" ]]; then
|
|
||||||
calculate_ip_parameters "$IF_IPADDR" "$IF_NETMASK"
|
|
||||||
[[ $? -eq 0 ]] || {
|
|
||||||
unset IF_IPADDR IF_NETMASK; continue; }
|
|
||||||
|
|
||||||
IF_NETWORK=$network
|
|
||||||
IF_BROADCAST=$broadcast
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
cat > $network_devices/ifcfg-${eth_interface} << _EOF
|
|
||||||
DEVICE=${eth_interface}
|
|
||||||
ONBOOT=yes
|
|
||||||
IPADDR=$IF_IPADDR
|
|
||||||
NETWORK=$IF_NETWORK
|
|
||||||
NETMASK=$IF_NETMASK
|
|
||||||
BROADCAST=$IF_BROADCAST
|
|
||||||
#NM_CONTROLLED=no
|
|
||||||
_EOF
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# FIXME
|
|
||||||
DEST_GATEWAY_ZONE=local
|
|
||||||
|
|
||||||
# Get Default Gateway IP address and DNS addresses
|
|
||||||
function net_config() {
|
|
||||||
unset DEST_GATEWAY_IP DNS_PRIMARY DNS_SECONDARY DEST_DOMAIN
|
|
||||||
let "retval = 0"
|
|
||||||
|
|
||||||
while test $retval != 99; do
|
|
||||||
let "error = 0"
|
|
||||||
$DIALOG --colors \
|
|
||||||
--cr-wrap \
|
|
||||||
--output-fd 4 \
|
|
||||||
--no-cancel \
|
|
||||||
--backtitle "\
|
|
||||||
$dialog_backtitle -- "$"Network devices configuration" \
|
|
||||||
--title $" DEFAULT GATEWAY / DNS ADDRESSES / DOMAIN " \
|
|
||||||
--form "
|
|
||||||
"$"Please enter the IP addresses of the \Z1default gateway\Zn, \
|
|
||||||
\Z1primary DNS server\Zn and \Z1secondary DNS server\Zn (optional) \
|
|
||||||
and the domain name." 13 72 4 \
|
|
||||||
$"Default gateway:" 1 1 "$DEST_GATEWAY_IP" 1 22 44 15 \
|
|
||||||
$"Primary DNS:" 2 1 "$DNS_PRIMARY" 2 22 44 15 \
|
|
||||||
$"Secondary DNS:" 3 1 "$DNS_SECONDARY" 3 22 44 15 \
|
|
||||||
$"Domain:" 4 1 "$DEST_DOMAIN" 4 22 44 15 4>$tmpdialog
|
|
||||||
|
|
||||||
case $? in
|
|
||||||
0) # workaround to correctly process blank fields and chars
|
|
||||||
let "icount = 0"
|
|
||||||
for field in $(sed 's/ /+_:\./g; s/^/=/g' $tmpdialog); do
|
|
||||||
field=`echo $field | sed 's/^=//; s/+_:\./ /g'`
|
|
||||||
case $icount in
|
|
||||||
0) DEST_GATEWAY_IP="$field"
|
|
||||||
# check for invalid IP addresses
|
|
||||||
ip_check_args "$DEST_GATEWAY_IP/32"
|
|
||||||
[[ $? -eq 1 ]] ||
|
|
||||||
{ unset DEST_GATEWAY_IP; let "error += 1"; } ;;
|
|
||||||
1) DNS_PRIMARY="$field"
|
|
||||||
ip_check_args "$DNS_PRIMARY/32"
|
|
||||||
[[ $? -eq 1 ]] ||
|
|
||||||
{ unset DNS_PRIMARY; let "error += 1"; } ;;
|
|
||||||
2) DNS_SECONDARY="$field"
|
|
||||||
if test -n "$DNS_SECONDARY"; then
|
|
||||||
ip_check_args "$DNS_SECONDARY/32"
|
|
||||||
[[ $? -eq 1 ]] ||
|
|
||||||
{ unset DNS_SECONDARY; let "error += 1"; }
|
|
||||||
fi ;;
|
|
||||||
3) DESTHOSTNAME="$field" ;;
|
|
||||||
esac
|
|
||||||
let "icount += 1"
|
|
||||||
done
|
|
||||||
|
|
||||||
[[ $error -eq 0 ]] && let "retval = 99" || continue
|
|
||||||
|
|
||||||
# DNS_SECONDARY is optional
|
|
||||||
if [[ -n "$DEST_GATEWAY_IP" && -n "$DNS_PRIMARY" ]]; then
|
|
||||||
# FIXME : has /etc/resolv.conf already been configured?
|
|
||||||
[[ -e $resolv_conf ]] && sed -i '/#/d' $resolv_conf
|
|
||||||
cat >> $resolv_conf << _EOF
|
|
||||||
domain $DESTHOSTNAME
|
|
||||||
search $DESTHOSTNAME
|
|
||||||
nameserver $DNS_PRIMARY
|
|
||||||
_EOF
|
|
||||||
[[ "$DNS_SECONDARY" ]] &&
|
|
||||||
echo "nameserver $DNS_SECONDARY" >> $resolv_conf
|
|
||||||
sed -i '/nameserver 127.0.0.1/d' $resolv_conf
|
|
||||||
# we want this line in the last position
|
|
||||||
echo "nameserver 127.0.0.1" >> $resolv_conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
(cd /etc/sysconfig/$network_devices/ &&
|
|
||||||
for sysconfile in $(ls ifcfg-* 2>/dev/null); do
|
|
||||||
. $sysconfile
|
|
||||||
# configure the default gateway using the first
|
|
||||||
# interface not configured with DHCP
|
|
||||||
if [[ "$ONBOOT" = yes && "$BOOTPROTO" != dhcp ]]; then
|
|
||||||
sed -i "/GATEWAY=/d;/GATEWAY_IF=/d" $sysconf_network
|
|
||||||
echo "\
|
|
||||||
GATEWAY_IF=${sysconfile##*\.}
|
|
||||||
GATEWAY=$DEST_GATEWAY_IP" >> $sysconf_network
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done) ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wlan_ints=()
|
|
||||||
for wlan_int in $(cat /proc/net/wireless 2>/dev/null | sed -n '/[a-z]*[0-9]*:/{s,:.*,,;p}'); do
|
|
||||||
# checks for existing physical interfaces
|
|
||||||
/sbin/ifconfig $wlan_int >/dev/null 2>&1 || continue
|
|
||||||
|
|
||||||
# found interface already configured
|
|
||||||
[ -e $network_devices/ifcfg-$wlan_int ] && continue
|
|
||||||
|
|
||||||
wlan_ints[${#wlan_ints[*]}]="$wlan_int"
|
|
||||||
echo "$wlan_int" >> $postplugnew_file 2>/dev/null
|
|
||||||
done
|
|
||||||
|
|
||||||
eth_ints=()
|
|
||||||
for eth_int in $(cat /proc/net/dev | sed -n '/eth[0-9]*:/{s,:.*,,;p}'); do
|
|
||||||
# checks for existing physical interfaces
|
|
||||||
/sbin/ifconfig $eth_int >/dev/null 2>&1 || continue
|
|
||||||
|
|
||||||
# found interface already configured
|
|
||||||
[ -e $network_devices/ifcfg-$eth_int ] && continue
|
|
||||||
|
|
||||||
eth_ints[${#eth_ints[*]}]="$eth_int"
|
|
||||||
echo "$eth_int" >> $postplugnew_file 2>/dev/null
|
|
||||||
done
|
|
||||||
|
|
||||||
# how many interface have been configured?
|
|
||||||
let "int_newconf = 0"
|
|
||||||
|
|
||||||
if [ ${#eth_ints[*]} -gt 0 ]; then
|
|
||||||
case "$NETWORK_NEWDEVICE" in
|
|
||||||
"auto")
|
|
||||||
for eth_int in ${eth_ints[*]}; do
|
|
||||||
eth_config_auto $eth_int
|
|
||||||
let "int_newconf += 1"
|
|
||||||
done
|
|
||||||
exit
|
|
||||||
;;
|
|
||||||
"dialog")
|
|
||||||
tmpdialog=`mktemp -q -t ${0##*/}.XXXXXXXX` ||
|
|
||||||
{ logmsg "$me" "error: "$"cannot create temporary files"
|
|
||||||
{ (exit 1); exit 1; }; }
|
|
||||||
trap "rm -f $tmpdialog" 0 1 2 3 5 15
|
|
||||||
|
|
||||||
$DIALOG --clear --colors $dialog_timeout_cmd \
|
|
||||||
--backtitle "\
|
|
||||||
$dialog_backtitle -- "$"Network devices configuration" \
|
|
||||||
--title $" LAN INTERFACE CONFIGURATION " \
|
|
||||||
--yesno "
|
|
||||||
"$"Found ${#eth_ints[*]} LAN interface(s) not configured.""
|
|
||||||
"$"Do you want to start the configuration wizard?" 8 62 2>/dev/null
|
|
||||||
|
|
||||||
case $? in
|
|
||||||
0) # ask configuration for all the eth. interfaces
|
|
||||||
for eth_int in ${eth_ints[*]}; do
|
|
||||||
eth_config --enable $eth_int
|
|
||||||
let "int_newconf += 1"
|
let "int_newconf += 1"
|
||||||
done ;;
|
|
||||||
1) # disable all the ethernet interfaces
|
|
||||||
for eth_int in ${eth_ints[*]}; do
|
|
||||||
eth_config --disable $eth_int
|
|
||||||
done
|
done
|
||||||
exit ;;
|
exit
|
||||||
*) : ;; # timeout (code = 255)
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
fi
|
||||||
"off"|"")
|
|
||||||
exit
|
|
||||||
;;
|
|
||||||
*) logmsg "$me" "error: "$"\
|
|
||||||
illegal value for NETWORK_NEWDEVICE ($NETWORK_NEWDEVICE)"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${#wlan_ints[*]} -gt 0 ]; then
|
|
||||||
# FIXME: wlan dialog support is missing
|
|
||||||
case "$NETWORK_NEWDEVICE" in
|
|
||||||
"auto")
|
|
||||||
for wlan_int in ${wlan_ints[*]}; do
|
|
||||||
wlan_config_auto $wlan_int
|
|
||||||
let "int_newconf += 1"
|
|
||||||
done
|
|
||||||
exit
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if at least one of the new interfaces has been configured...
|
|
||||||
if [ $NETWORK_NEWDEVICE = "dialog" -a $int_newconf -gt 0 ]; then
|
|
||||||
|
|
||||||
for eth_int in ${eth_ints[*]}; do
|
|
||||||
[ -r $network_devices/ifcfg-$eth_int ] || continue
|
|
||||||
unset BOOTPROTO
|
|
||||||
. $network_devices/ifcfg-$eth_int
|
|
||||||
[ "$BOOTPROTO" = "dhcp" ] && exit
|
|
||||||
done
|
|
||||||
|
|
||||||
for wlan_int in ${wlan_ints[*]}; do
|
|
||||||
[ -r $network_devices/ifcfg-$wlan_int ] || continue
|
|
||||||
unset BOOTPROTO
|
|
||||||
. $network_devices/ifcfg-$wlan_int
|
|
||||||
[ "$BOOTPROTO" = "dhcp" ] && exit
|
|
||||||
done
|
|
||||||
|
|
||||||
# if no interface has been configured as DHCP interface
|
|
||||||
# get the Default Gateway + DNS + Domain infos via a dialog window
|
|
||||||
net_config
|
|
||||||
$DIALOG --clear
|
|
||||||
fi
|
|
||||||
|
|
||||||
# modify the file /etc/hosts if a static IP has been configured
|
|
||||||
#if grep -Eq "^127\.0\.0\.1 `hostname -f`" /etc/hosts; then
|
|
||||||
# get_interfaces_by_zone
|
|
||||||
# # check first local interfaces, then public ones and finally dmz interfaces
|
|
||||||
# for if_name in ${ifzone_local[*]} ${ifzone_public[*]} ${ifzone_dmz[*]}; do
|
|
||||||
# get_interface_parameters $if_name
|
|
||||||
# if [[ $? -eq 0 && "$int_static_ip" = 1 ]]; then
|
|
||||||
# sed -i "\
|
|
||||||
#/127\.0\.0\.1 `hostname -f`/{
|
|
||||||
# s/.*/127.0.0.1 localhost.localdomain localhost/}
|
|
||||||
# /127.0.0.1.*/a\\
|
|
||||||
#$int_ip `hostname -f` `hostname`" /etc/hosts
|
|
||||||
# fi
|
|
||||||
# done
|
|
||||||
#fi
|
|
||||||
|
|
||||||
rm -f $tmpdialog
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# xorg - xorg plugin for postplug
|
# xorg - xorg plugin for postplug
|
||||||
# Copyright (c) 2004-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (c) 2004-2023 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@gmail.com>
|
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
|
|
||||||
if [ $UID != 0 ]; then
|
if [ $UID != 0 ]; then
|
||||||
@ -18,8 +18,6 @@ me="xorg"
|
|||||||
|
|
||||||
XORGCONF=/etc/X11/xorg.conf
|
XORGCONF=/etc/X11/xorg.conf
|
||||||
|
|
||||||
kernel_min=$(uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,')
|
|
||||||
|
|
||||||
# xorg_section_screen_config()
|
# xorg_section_screen_config()
|
||||||
# write a new xorg configuration
|
# write a new xorg configuration
|
||||||
# args:
|
# args:
|
||||||
@ -48,53 +46,21 @@ function xorg_section_screen_config() {
|
|||||||
mv $XORGCONF.new $XORGCONF
|
mv $XORGCONF.new $XORGCONF
|
||||||
}
|
}
|
||||||
|
|
||||||
# xorg_set_alternatives()
|
## xorg_set_alternatives()
|
||||||
# set alternatives and xorg configuration for specific video drivers
|
## set alternatives and xorg configuration for specific video drivers
|
||||||
function xorg_set_alternatives() {
|
#function xorg_set_alternatives() {
|
||||||
|
#if [ "$VIDEODRIVER" = "nvidia" ]; then
|
||||||
if [ "$VIDEODRIVER" = "nvidia" ]; then
|
# grep -q '^[^#]*\"AllowGLXWithComposite\"' $XORGCONF ||
|
||||||
grep -q '^[^#]*\"AllowGLXWithComposite\"' $XORGCONF ||
|
# sed -i -e '/Driver\W*"nvidia"/a\
|
||||||
sed -i -e '/Driver\W*"nvidia"/a\
|
# Option \"RenderAccel\" \"true\"\
|
||||||
Option \"RenderAccel\" \"true\"\
|
# Option \"AllowGLXWithComposite\" \"on\"\
|
||||||
Option \"AllowGLXWithComposite\" \"on\"\
|
# Option \"NoLogo\" \"true\"' $XORGCONF
|
||||||
Option \"NoLogo\" \"true\"' $XORGCONF
|
#fi
|
||||||
|
#}
|
||||||
# detect and update alternatives for nvidia driver
|
|
||||||
nvidia-autoselect-driver
|
|
||||||
elif [ "$VIDEODRIVER" = "fglrx" -o "$VIDEODRIVER" = "avivo" ]; then
|
|
||||||
# update alternatives for fglrx driver
|
|
||||||
/usr/sbin/update-alternatives --auto libglx.so || true
|
|
||||||
[ -x /usr/sbin/update-alternatives-set-fglrx ] && /usr/sbin/update-alternatives-set-fglrx
|
|
||||||
else
|
|
||||||
# set default alternatives
|
|
||||||
[ -x /usr/sbin/update-alternatives-set-dri ] && /usr/sbin/update-alternatives-set-dri
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# xorg_configure_loginmanager()
|
|
||||||
# configure inittab for runlelve 5 init and kdm as loginmanager
|
|
||||||
function xorg_configure_loginmanager() {
|
|
||||||
|
|
||||||
# login_manager configuration
|
|
||||||
[ ! "`grep "^x:5:" /etc/inittab`" ] && {
|
|
||||||
cat >> /etc/inittab << _EOF
|
|
||||||
|
|
||||||
# run graphical login manager
|
|
||||||
x:5:respawn:login_manager
|
|
||||||
_EOF
|
|
||||||
|
|
||||||
# configure kdm as the default login_manager if none is set
|
|
||||||
/usr/sbin/alternatives --display login_manager >/dev/null ||
|
|
||||||
/usr/sbin/alternatives --install /usr/sbin/login_manager login_manager /opt/kde/bin/kdm 20
|
|
||||||
|
|
||||||
telinit q
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function xorg_d_configure_input() {
|
function xorg_d_configure_input() {
|
||||||
# Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d)
|
# Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d)
|
||||||
[ ! -e /etc/X11/xorg.conf.d/10-keyboard.conf -o \
|
[ ! -e /etc/X11/xorg.conf.d/00-keyboard.conf ] && {
|
||||||
/etc/sysconfig/keyboard -nt /etc/X11/xorg.conf.d/10-keyboard.conf ] && {
|
|
||||||
|
|
||||||
if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then
|
if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then
|
||||||
case "${LANG:0:2}" in
|
case "${LANG:0:2}" in
|
||||||
@ -116,48 +82,28 @@ function xorg_d_configure_input() {
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat > /etc/X11/xorg.conf.d/10-keyboard.conf << __EOF
|
cat > /etc/X11/xorg.conf.d/00-keyboard.conf << __EOF
|
||||||
|
# Created by postplug
|
||||||
Section "InputClass"
|
Section "InputClass"
|
||||||
Identifier "Keyboard Defaults"
|
Identifier "system-keyboard"
|
||||||
MatchIsKeyboard "on"
|
MatchIsKeyboard "on"
|
||||||
Driver "evdev"
|
|
||||||
Option "XkbLayout" "$XKB_LAYOUT"
|
Option "XkbLayout" "$XKB_LAYOUT"
|
||||||
__EOF
|
__EOF
|
||||||
[ "$XKB_MODEL" ] && echo " Option \"XkbModel\" \"$XKB_MODEL\"" >>/etc/X11/xorg.conf.d/10-keyboard.conf
|
[ "$XKB_MODEL" ] && echo " Option \"XkbModel\" \"$XKB_MODEL\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf
|
||||||
[ "$XKB_VARIANT" ] && echo " Option \"XkbVariant\" \"$XKB_VARIANT\"" >>/etc/X11/xorg.conf.d/10-keyboard.conf
|
[ "$XKB_VARIANT" ] && echo " Option \"XkbVariant\" \"$XKB_VARIANT\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf
|
||||||
[ "$XKB_OPTIONS" ] && echo " Option \"XkbOptions\" \"$XKB_OPTIONS\"" >>/etc/X11/xorg.conf.d/10-keyboard.conf
|
if [ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ]; then
|
||||||
echo "EndSection" >>/etc/X11/xorg.conf.d/10-keyboard.conf
|
XKB_OPTIONS="${XKB_OPTIONS},lv3:rwin_switch"
|
||||||
|
fi
|
||||||
|
[ "$XKB_OPTIONS" ] && echo " Option \"XkbOptions\" \"$XKB_OPTIONS\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf
|
||||||
|
echo "EndSection" >>/etc/X11/xorg.conf.d/00-keyboard.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
# configure keyboard options for Apple computers
|
if [ -e /etc/X11/xorg.conf.d/10-keyboard.conf ]; then
|
||||||
if [ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ]; then
|
rm -f /etc/X11/xorg.conf.d/10-keyboard.conf
|
||||||
cat > /etc/X11/xorg.conf.d/15-keyboard-apple.conf << __EOF
|
fi
|
||||||
Section "InputClass"
|
if [ -e /etc/X11/xorg.conf.d/15-keyboard-apple.conf ]; then
|
||||||
Identifier "Keyboard mac"
|
|
||||||
Driver "evdev"
|
|
||||||
Option "XkbOptions" ",lv3:rwin_switch" # Mac only
|
|
||||||
MatchIsKeyboard "on"
|
|
||||||
EndSection
|
|
||||||
__EOF
|
|
||||||
elif [ -e /etc/X11/xorg.conf.d/15-keyboard-apple.conf ]; then
|
|
||||||
rm -f /etc/X11/xorg.conf.d/15-keyboard-apple.conf
|
rm -f /etc/X11/xorg.conf.d/15-keyboard-apple.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ ! -e /etc/X11/xorg.conf.d/20-synaptics.conf ] && {
|
|
||||||
cat > /etc/X11/xorg.conf.d/20-touchpad.conf << __EOF
|
|
||||||
Section "InputClass"
|
|
||||||
Identifier "touchpad defaults"
|
|
||||||
Driver "synaptics"
|
|
||||||
Option "RTCornerButton" "2"
|
|
||||||
Option "HorizEdgeScroll" "true"
|
|
||||||
Option "TapButton1" "1"
|
|
||||||
Option "TapButton2" "2"
|
|
||||||
Option "TapButton3" "3"
|
|
||||||
Option "HorizScrollDelta" "0"
|
|
||||||
MatchIsTouchpad "on"
|
|
||||||
EndSection
|
|
||||||
__EOF
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# (re)create the '/tmp/.ICE-unix' directory with the right permissions
|
# (re)create the '/tmp/.ICE-unix' directory with the right permissions
|
||||||
@ -169,6 +115,7 @@ if [ -e /dev/nvhost-ctrl ]; then
|
|||||||
VIDEO_DEV="NVIDIA TEGRA"
|
VIDEO_DEV="NVIDIA TEGRA"
|
||||||
else
|
else
|
||||||
VIDEO_DEV="`lspci -n 2>/dev/null | grep " 03[0-9][0-9]: "`"
|
VIDEO_DEV="`lspci -n 2>/dev/null | grep " 03[0-9][0-9]: "`"
|
||||||
|
[ "$VIDEO_DEV" ] || VIDEO_DEV="embedded-unknown"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then
|
if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then
|
||||||
@ -185,28 +132,22 @@ if [ -e $XORGCONF ]; then
|
|||||||
VIDEODRIVER=${VIDEODRIVERS[0]}
|
VIDEODRIVER=${VIDEODRIVERS[0]}
|
||||||
|
|
||||||
[ -e /sys/module/nouveau/parameters/modeset ] && NOUVEAU_MODESET=`cat /sys/module/nouveau/parameters/modeset`
|
[ -e /sys/module/nouveau/parameters/modeset ] && NOUVEAU_MODESET=`cat /sys/module/nouveau/parameters/modeset`
|
||||||
|
[ "$NOUVEAU_MODESET" = "-1" ] && NOUVEAU_MODESET=1
|
||||||
[ -e /sys/module/radeon/parameters/modeset ] && RADEON_MODESET=`cat /sys/module/radeon/parameters/modeset`
|
[ -e /sys/module/radeon/parameters/modeset ] && RADEON_MODESET=`cat /sys/module/radeon/parameters/modeset`
|
||||||
|
[ "$RADEON_MODESET" = "-1" ] && RADEON_MODESET=1
|
||||||
|
|
||||||
if [ "$VIDEODRIVER" = "nvidia" -a "$NOUVEAU_MODESET" = "1" ]; then
|
if [ "$VIDEODRIVER" = "nvidia" -a "$NOUVEAU_MODESET" = "1" ]; then
|
||||||
# replace nvidia with nouveau
|
# replace nvidia with nouveau
|
||||||
mv $XORGCONF $XORGCONF.postplug.nvidia.save
|
mv $XORGCONF $XORGCONF.postplug.nvidia.save
|
||||||
rmmod nvidia
|
rmmod nvidia
|
||||||
echo "blacklist nvidia" > /etc/modprobe.d/postplug-nouveau.conf
|
echo "blacklist nvidia" > /etc/modprobe.d/postplug-nouveau.conf
|
||||||
elif [ "$VIDEODRIVER" = "nouveau" -a "$NOUVEAU_MODESET" != "1" ]; then
|
VIDEODRIVER=""
|
||||||
# replace nouveau with nvidia
|
elif [ "$NOUVEAU_MODESET" = "0" ]; then
|
||||||
|
# replace nouveau with nvidia (NOUVEAU_MODESET=0 means we have nvidia chip)
|
||||||
mv $XORGCONF $XORGCONF.postplug.nouveau.save
|
mv $XORGCONF $XORGCONF.postplug.nouveau.save
|
||||||
rmmod nouveau
|
rmmod nouveau
|
||||||
rm -f /etc/modprobe.d/postplug-nouveau.conf
|
rm -f /etc/modprobe.d/postplug-nouveau.conf
|
||||||
elif [ "$VIDEODRIVER" = "fglrx" -a "$RADEON_MODESET" = "1" ]; then
|
VIDEODRIVER="nvidia"
|
||||||
# replace fglrx with radeon
|
|
||||||
mv $XORGCONF $XORGCONF.postplug.fglrx.save
|
|
||||||
rmmod fglrx
|
|
||||||
echo "blacklist fglrx" > /etc/modprobe.d/postplug-radeon.conf
|
|
||||||
elif [ "$VIDEODRIVER" = "radeon" -a "$RADEON_MODESET" != "1" ]; then
|
|
||||||
# replace radeon with fglrx
|
|
||||||
mv $XORGCONF $XORGCONF.postplug.radeon.save
|
|
||||||
rmmod radeon
|
|
||||||
rm -f /etc/modprobe.d/postplug-radeon.conf
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -218,34 +159,22 @@ if [ ! -e $XORGCONF ]; then
|
|||||||
# use default xorg.conf for Tegra
|
# use default xorg.conf for Tegra
|
||||||
cp $XORGCONF.tegra $XORGCONF
|
cp $XORGCONF.tegra $XORGCONF
|
||||||
else
|
else
|
||||||
# fix set dri alternatives
|
|
||||||
xorg_set_alternatives
|
|
||||||
|
|
||||||
# ATI fglrx driver test workaround (Xorg -configure crashes with it)
|
|
||||||
# Note: assuming that fglrx loads if the video card is supported
|
|
||||||
let "ATI_DRV = 0"
|
|
||||||
[ "`/sbin/lsmod 2>/dev/null | grep ^fglrx `" ] && let "ATI_DRV = 1"
|
|
||||||
|
|
||||||
[ "$ATI_DRV" = "1" ] && VIDEODRIVER=ati
|
|
||||||
|
|
||||||
# remove any nvidia driver loaded as they don't load according to PCIID
|
# remove any nvidia driver loaded as they don't load according to PCIID
|
||||||
[ "`/sbin/lsmod 2>/dev/null | grep ^nvidia `" ] && rmmod nvidia
|
[ "`/sbin/lsmod 2>/dev/null | grep ^nvidia `" ] && rmmod nvidia
|
||||||
# detect and configure nvidia driver
|
|
||||||
[ "$freevideo" ] || nvidia-autoselect-driver
|
|
||||||
|
|
||||||
# sync to avoid filesystem corruption in case of system hang on probe
|
# sync to avoid filesystem corruption in case of system hang on probe
|
||||||
sync
|
sync
|
||||||
|
|
||||||
rm -f /tmp/xorg.conf.new
|
rm -f /tmp/xorg.conf.new
|
||||||
HOME=/tmp Xorg :5 -configure 2>>$logfile
|
logmsg "$me" "info: running Xorg -configure"
|
||||||
|
tmpfile=`mktemp`
|
||||||
|
HOME=/tmp Xorg :5 -configure 2>>$tmpfile
|
||||||
RET=$?
|
RET=$?
|
||||||
if [ $RET -ne 0 -o ! -e /tmp/xorg.conf.new ]; then
|
grep "Server terminated with error" $tmpfile >/dev/null && RET=255
|
||||||
|
logmsg "$me" "info: Xorg -configure return code was $RET"
|
||||||
|
if [ $RET -ne 0 -a "$NOUVEAU_MODESET" != "0" ]; then
|
||||||
logmsg "$me" "warning: xorg autoprobed configuration failed; using xorg autoconfig"
|
logmsg "$me" "warning: xorg autoprobed configuration failed; using xorg autoconfig"
|
||||||
VIDEO_DEV="autoprobe"
|
|
||||||
echo "# Dummy empty xorg.conf file created by postplug" > $XORGCONF
|
echo "# Dummy empty xorg.conf file created by postplug" > $XORGCONF
|
||||||
xorg_configure_loginmanager
|
|
||||||
xorg_d_configure_input
|
|
||||||
exit 1
|
|
||||||
else
|
else
|
||||||
mv /tmp/xorg.conf.new $XORGCONF
|
mv /tmp/xorg.conf.new $XORGCONF
|
||||||
sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF
|
sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF
|
||||||
@ -254,72 +183,21 @@ if [ ! -e $XORGCONF ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
let "CONFCREATED = 1"
|
let "CONFCREATED = 1"
|
||||||
|
VIDEODRIVERS=(`sed -n "/Section[ \t]\"Device\"/,/EndSection/{s/^[ \t]*Driver[ \t]*\"\(.*\)\"/\1/p}" $XORGCONF`)
|
||||||
|
# assume first driver as default videodriver
|
||||||
|
VIDEODRIVER=${VIDEODRIVERS[0]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DISPLAYSIZE="`sed -n "/Section[ \t]\"Monitor\"/,/EndSection/{s/[ \t]*DisplaySize[ \t]*\(.*\)/\1/p}" $XORGCONF`"
|
if [ "$CONFCREATED" = "1" -a "$VIDEODRIVER" ]; then
|
||||||
VIDEODRIVERS=(`sed -n "/Section[ \t]\"Device\"/,/EndSection/{s/^[ \t]*Driver[ \t]*\"\(.*\)\"/\1/p}" $XORGCONF`)
|
|
||||||
|
|
||||||
# assume first driver as default videodriver
|
|
||||||
VIDEODRIVER=${VIDEODRIVERS[0]}
|
|
||||||
|
|
||||||
if [ "$CONFCREATED" = "1" ]; then
|
|
||||||
|
|
||||||
[ "`grep nomodeset /proc/cmdline`" ] && nomodeset=1
|
[ "`grep nomodeset /proc/cmdline`" ] && nomodeset=1
|
||||||
|
|
||||||
if [ "$nomodeset" = "1" -a "$VIDEODRIVER" = "nouveau" ]; then
|
if [ "$nomodeset" = "1" -a "$VIDEODRIVER" = "nouveau" ]; then
|
||||||
sed -i "s|Driver\W*\"nouveau\"|Driver \"nvidia\"|" $XORGCONF
|
sed -i "s|Driver\W*\"nouveau\"|Driver \"nvidia\"|" $XORGCONF
|
||||||
VIDEODRIVER=nvidia
|
VIDEODRIVER=nvidia
|
||||||
xorg_set_alternatives
|
|
||||||
rmmod nouveau nvidia
|
rmmod nouveau nvidia
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ATI_DRV" = 1 -a ! "$freevideo" ]; then
|
|
||||||
|
|
||||||
sed -i -e '/Load\W*\"extmod\"/a\
|
|
||||||
SubSection "extmod"\
|
|
||||||
Option "omit xfree86-dga"\
|
|
||||||
EndSubSection' $XORGCONF
|
|
||||||
|
|
||||||
sed -i '/Load\W*\"extmod\"/d' $XORGCONF
|
|
||||||
sed -i "s|Driver\W*\"vesa\"|Driver \"fglrx\"|" $XORGCONF
|
|
||||||
sed -i "s|Driver\W*\"ati\"|Driver \"fglrx\"|" $XORGCONF
|
|
||||||
sed -i "s|Driver\W*\"avivo\"|Driver \"fglrx\"|" $XORGCONF
|
|
||||||
sed -i "s|Driver\W*\"radeon\"|Driver \"fglrx\"|" $XORGCONF
|
|
||||||
sed -i "s|Driver\W*\"radeonhd\"|Driver \"fglrx\"|" $XORGCONF
|
|
||||||
|
|
||||||
VIDEODRIVER=fglrx
|
|
||||||
xorg_set_alternatives
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Setting video modes...
|
|
||||||
|
|
||||||
# get DCC values detected by xorg and verify that they have reasonable ranges
|
|
||||||
#HORIZSYNCMIN=(`grep "^# HorizSync.*" $XORGCONF | awk '{ print $3 }'`)
|
|
||||||
#HORIZSYNCMAX=(`grep "^# HorizSync.*" $XORGCONF | awk '{ print $5 }'`)
|
|
||||||
|
|
||||||
#unset reasonable
|
|
||||||
#for currsync in `seq 0 ${#HORIZSYNCMIN[@]}`; do
|
|
||||||
# if [ `expr "${HORIZSYNCMIN[$currsync]}" \> 15` = 1 -a \
|
|
||||||
# `expr "${HORIZSYNCMIN[$currsync]}" \< 100` = 0 -a \
|
|
||||||
# `expr "${HORIZSYNCMAX[$currsync]}" \> 30` = 1 -a \
|
|
||||||
# `expr "${HORIZSYNCMAX[$currsync]}" \< 201` = 0 -a \
|
|
||||||
# `expr "${HORIZSYNCMAX[$currsync]}" \>= "${HORIZSYNCMIN[$currsync]}"` = 1 ]; then
|
|
||||||
# reasonable=$currsync
|
|
||||||
# break
|
|
||||||
# fi
|
|
||||||
#done
|
|
||||||
|
|
||||||
#if [ "$reasonable" ]; then
|
|
||||||
# sed -i -e "/Section\W*\"Monitor\"/a\
|
|
||||||
# HorizSync ${HORIZSYNCMIN[$reasonable]}-${HORIZSYNCMAX[$reasonable]}" \
|
|
||||||
# $XORGCONF
|
|
||||||
#else
|
|
||||||
#if [ ! "$DISPLAYSIZE" ]; then
|
|
||||||
# sed -i -e '/Section\W*"Monitor"/a\
|
|
||||||
# DisplaySize 320 240' $XORGCONF
|
|
||||||
#fi
|
|
||||||
|
|
||||||
case "$VIDEODRIVER" in
|
case "$VIDEODRIVER" in
|
||||||
vesa|vga) sed -i -e '/Section "Screen"/a\
|
vesa|vga) sed -i -e '/Section "Screen"/a\
|
||||||
#DefaultColorDepth 24' $XORGCONF ;;
|
#DefaultColorDepth 24' $XORGCONF ;;
|
||||||
@ -407,15 +285,13 @@ if [ "$CONFCREATED" = "1" ]; then
|
|||||||
|
|
||||||
# echo "$XORGCONF" > $postplugnew_file
|
# echo "$XORGCONF" > $postplugnew_file
|
||||||
|
|
||||||
xorg_set_alternatives
|
|
||||||
|
|
||||||
# Final probe
|
# Final probe
|
||||||
[ -f /var/log/Xorg.5.log ] && rm -f /var/log/Xorg.5.log
|
[ -f /var/log/Xorg.5.log ] && rm -f /var/log/Xorg.5.log
|
||||||
|
|
||||||
# sync to avoid filesystem corruption in case of system hang on probe
|
# sync to avoid filesystem corruption in case of system hang on probe
|
||||||
sync
|
sync
|
||||||
|
|
||||||
xinit /bin/true -- :5 2>>$logfile
|
xinit /bin/true -- :5
|
||||||
|
|
||||||
if [ -r /var/log/Xorg.5.log ]; then
|
if [ -r /var/log/Xorg.5.log ]; then
|
||||||
|
|
||||||
@ -472,7 +348,7 @@ warning: DDC hsync range cannot be detected, setting default of 30-49 kHz"
|
|||||||
HorizSync 30-49' $XORGCONF
|
HorizSync 30-49' $XORGCONF
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "$PANEL_SIZE_DETECTED" ] ||
|
[ "$HSYNC_RANGE_NOT_DETECTED" -a ! "$PANEL_SIZE_DETECTED" ] &&
|
||||||
sed -i -e '/SubSection "Display"/a\
|
sed -i -e '/SubSection "Display"/a\
|
||||||
Modes "1024x768" "800x600" "640x480"' $XORGCONF
|
Modes "1024x768" "800x600" "640x480"' $XORGCONF
|
||||||
else
|
else
|
||||||
@ -480,6 +356,9 @@ warning: DDC hsync range cannot be detected, setting default of 30-49 kHz"
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ "$VIDEO_DEV" -a "$VIDEO_DEV" != "$VIDEO_DEV_CACHED" ] &&
|
||||||
|
echo "$VIDEO_DEV" > $postpluglibdir/xorg.cache
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
#
|
#
|
||||||
# Xorg dynamic configuration section
|
# Xorg dynamic configuration section
|
||||||
@ -488,41 +367,68 @@ fi
|
|||||||
|
|
||||||
# radeon: enable a conservative power profile (mid) by default
|
# radeon: enable a conservative power profile (mid) by default
|
||||||
if [ -e /sys/class/drm/card0/device/power_profile ]; then
|
if [ -e /sys/class/drm/card0/device/power_profile ]; then
|
||||||
echo mid > /sys/class/drm/card0/device/power_profile
|
[ "$XORG_POWER_PROFILE" ] || XORG_POWER_PROFILE="mid"
|
||||||
|
echo $XORG_POWER_PROFILE > /sys/class/drm/card0/device/power_profile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -e $XORGCONF ] || {
|
# Configure keyboard
|
||||||
logmsg "$me" "error: "$"missing Xorg configuration file; aborting"
|
xorg_d_configure_input
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# configure inittab for login manager
|
if [ -d /sys/devices/platform/sunxi-rtc -a ! -e /etc/X11/xorg.conf.d/30-serverflags.conf ]; then
|
||||||
xorg_configure_loginmanager
|
# Workaround: disable DPMS on BananaPi
|
||||||
|
cat > /etc/X11/xorg.conf.d/30-serverflags.conf << _EOF
|
||||||
|
Section "ServerFlags"
|
||||||
|
Option "StandbyTime" "0"
|
||||||
|
Option "SuspendTime" "0"
|
||||||
|
Option "OffTime" "0"
|
||||||
|
EndSection
|
||||||
|
_EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# enable 'Composite' extensions
|
||||||
|
if [ "$VIDEODRIVER" -a "$VIDEODRIVER" != "mga" -a ! -e /etc/X11/xorg.conf.d/40-extensions.conf ]; then
|
||||||
|
cat > /etc/X11/xorg.conf.d/40-extensions.conf << _EOF
|
||||||
|
Section "Extensions"
|
||||||
|
Option "Composite" "true"
|
||||||
|
EndSection
|
||||||
|
_EOF
|
||||||
|
elif [ "$VIDEODRIVER" != "mga" -a -e /etc/X11/xorg.conf.d/40-extensions.conf ]; then
|
||||||
|
rm -f /etc/X11/xorg.conf.d/40-extensions.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# add 'Section "DRI"'
|
||||||
|
if [ "$VIDEODRIVER" -a "$VIDEODRIVER" != "mga" -a ! -e /etc/X11/xorg.conf.d/50-dri.conf ]; then
|
||||||
|
cat > /etc/X11/xorg.conf.d/50-dri.conf << _EOF
|
||||||
|
Section "DRI"
|
||||||
|
Mode 0666
|
||||||
|
EndSection
|
||||||
|
_EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d /sys/devices/platform/sunxi-rtc -a ! -e /etc/X11/xorg.conf.d/30-serverflags.conf ]; then
|
||||||
|
# Workaround: disable DPMS on BananaPi
|
||||||
|
cat > /etc/X11/xorg.conf.d/30-serverflags.conf << _EOF
|
||||||
|
Section "ServerFlags"
|
||||||
|
Option "StandbyTime" "0"
|
||||||
|
Option "SuspendTime" "0"
|
||||||
|
Option "OffTime" "0"
|
||||||
|
EndSection
|
||||||
|
_EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Workaround symlink for libglx.so (or Xorg will choose the wrong one)
|
||||||
|
if [ -e /usr/lib/xorg/modules/extensions/libglx.so -a ! -e /usr/lib/xorg/modules/libglx.so ]; then
|
||||||
|
ln -s extensions/libglx.so /usr/lib/xorg/modules/extensions/libglx.so
|
||||||
|
fi
|
||||||
|
if [ -e /usr/lib64/xorg/modules/extensions/libglx.so -a ! -e /usr/lib64/xorg/modules/libglx.so ]; then
|
||||||
|
ln -s extensions/libglx.so /usr/lib64/xorg/modules/libglx.so
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -e $XORGCONF -a "$VIDEODRIVER" ] || exit 0
|
||||||
|
|
||||||
# add missing brackets to Xorg.conf device entries
|
# add missing brackets to Xorg.conf device entries
|
||||||
sed -i "s|^[ \t]*Driver[ \t]*\([A-Za-z0-9]*\)[ \t]*$| Driver \"\1\"|g" $XORGCONF
|
sed -i "s|^[ \t]*Driver[ \t]*\([A-Za-z0-9]*\)[ \t]*$| Driver \"\1\"|g" $XORGCONF
|
||||||
|
|
||||||
# add 'Section "DRI"' if not present...
|
|
||||||
if [ "$XORG_ENABLE_DRI" = "on" ]; then
|
|
||||||
grep -q 'Section "DRI"' $XORGCONF
|
|
||||||
[ $? -eq 1 ] && echo "
|
|
||||||
Section \"DRI\"
|
|
||||||
Mode 0666
|
|
||||||
EndSection" >> $XORGCONF
|
|
||||||
fi
|
|
||||||
|
|
||||||
# enable 'Composite' extensions if not present...
|
|
||||||
if [[ "$XORG_ENABLE_COMPOSITE_EXT" = "on" ]]; then
|
|
||||||
grep -q 'Section "Extensions"' $XORGCONF
|
|
||||||
[ $? -eq 1 ] && echo "
|
|
||||||
Section \"Extensions\"
|
|
||||||
Option \"Composite\" \"true\"
|
|
||||||
EndSection" >> $XORGCONF
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set alternative configuration for different video drivers
|
|
||||||
xorg_set_alternatives
|
|
||||||
|
|
||||||
# Configure Mice...
|
# Configure Mice...
|
||||||
|
|
||||||
# remove wrong configuration for USBMouse (duplicating PS2MOUSE)
|
# remove wrong configuration for USBMouse (duplicating PS2MOUSE)
|
||||||
@ -539,16 +445,10 @@ sed -i "/\W*Option \"Device\".*/d" $XORGCONF
|
|||||||
# remove obsoleted XAANoOffscreenPixmaps
|
# remove obsoleted XAANoOffscreenPixmaps
|
||||||
sed -i '/^[[:space:]]*Option[[:space:]]*"XAANoOffscreenPixmaps" "true"/d' $XORGCONF
|
sed -i '/^[[:space:]]*Option[[:space:]]*"XAANoOffscreenPixmaps" "true"/d' $XORGCONF
|
||||||
|
|
||||||
# Configure keyboard
|
|
||||||
xorg_d_configure_input
|
|
||||||
|
|
||||||
# disable keyboard configuration for Xorg >= 1.4
|
# disable keyboard configuration for Xorg >= 1.4
|
||||||
sed -i "s|^\([[:space:]]*InputDevice\W*\"Keyboard0\".*\)|#\1|" $XORGCONF
|
sed -i "s|^\([[:space:]]*InputDevice\W*\"Keyboard0\".*\)|#\1|" $XORGCONF
|
||||||
|
|
||||||
# FIXME: delete empty lines
|
# FIXME: delete empty lines
|
||||||
sed -i '/./,$!d' $XORGCONF
|
sed -i '/./,$!d' $XORGCONF
|
||||||
|
|
||||||
[ "$CONFCREATED" = "1" -o ! -e $postpluglibdir/xorg.cache ] && \
|
|
||||||
echo "$VIDEO_DEV" > $postpluglibdir/xorg.cache
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# sound - sound configuration plugin for postplug
|
# sound - sound configuration plugin for postplug
|
||||||
# Copyright (c) 2005-2007 by Davide Madrisan <davide.madrisan@gmail.com>
|
# Copyright (c) 2005-2007 by Davide Madrisan <davide.madrisan@gmail.com>
|
||||||
# Copyright (c) 2005-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (c) 2005-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
|
||||||
# Note: Some code has been stolen from /usr/sbin/alsaconf version 1.0.13
|
# Note: Some code has been stolen from /usr/sbin/alsaconf version 1.0.13
|
||||||
|
|
||||||
@ -14,22 +14,17 @@ fi
|
|||||||
me="sound"
|
me="sound"
|
||||||
|
|
||||||
[ -r /etc/sysconfig/machine ] && . /etc/sysconfig/machine
|
[ -r /etc/sysconfig/machine ] && . /etc/sysconfig/machine
|
||||||
|
|
||||||
. /etc/postplug/postplug.defs
|
. /etc/postplug/postplug.defs
|
||||||
|
|
||||||
[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug
|
[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug
|
||||||
|
|
||||||
SYSCONFIG_SOUNDCARDS=/etc/sysconfig/soundcards
|
SYSCONFIG_SOUNDCARDS=/etc/sysconfig/soundcards
|
||||||
|
|
||||||
[ -e /etc/asound.state ] && rm -f /etc/asound.state
|
|
||||||
|
|
||||||
# set default mixer volumes
|
# set default mixer volumes
|
||||||
function set_mixers() {
|
function set_mixers() {
|
||||||
[ -x /usr/bin/amixer ] || return
|
[ -x /usr/bin/amixer ] || return
|
||||||
channel=$1
|
channel=$1
|
||||||
[ "$channel" ] || channel=0
|
[ "$channel" ] || channel=0
|
||||||
|
|
||||||
/usr/bin/amixer -s -c $channel -q <<_EOF
|
/usr/bin/amixer -s -c $channel -q <<_EOF
|
||||||
# Playback channels
|
# Playback channels
|
||||||
set 'Master' 90% unmute
|
set 'Master' 90% unmute
|
||||||
# some notebooks use headphone instead of master
|
# some notebooks use headphone instead of master
|
||||||
@ -84,16 +79,6 @@ if [ ! "$SOUND_DEV" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Raspberry PI
|
|
||||||
if [ -e /sys/module/spi_bcm2708 -a ! -e /proc/asound/card0 ]; then
|
|
||||||
modprobe snd-bcm2835
|
|
||||||
if [ -e /proc/asound/card0 ]; then
|
|
||||||
echo "snd-bcm2835" > /etc/modules.d/snd-bcm2835.conf
|
|
||||||
update-alternatives --set asound.conf /etc/asound.conf.dummy
|
|
||||||
SOUND_DEV="`md5sum /proc/asound/cards 2>/dev/null`"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$SOUND_FORCE_RESCAN" != "on" -a "$SOUND_FORCE_RESCAN" != "1" ]; then
|
if [ "$SOUND_FORCE_RESCAN" != "on" -a "$SOUND_FORCE_RESCAN" != "1" ]; then
|
||||||
if [ -e $postpluglibdir/sound.cache ]; then
|
if [ -e $postpluglibdir/sound.cache ]; then
|
||||||
SOUND_DEV_CACHED="`cat $postpluglibdir/sound.cache`"
|
SOUND_DEV_CACHED="`cat $postpluglibdir/sound.cache`"
|
||||||
@ -103,7 +88,17 @@ if [ "$SOUND_FORCE_RESCAN" != "on" -a "$SOUND_FORCE_RESCAN" != "1" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$SOUND_DEV" > $postpluglibdir/sound.cache
|
if [ -e /sys/module/spi_bcm2708 ]; then
|
||||||
|
# Raspberry PI
|
||||||
|
update-alternatives --set asound.conf /etc/asound.conf.dummy
|
||||||
|
elif [ -e /proc/asound/MidasWM1811 ]; then
|
||||||
|
# Galaxy Note 10.1
|
||||||
|
/usr/sbin/alsactl restore -f /usr/share/alsa/ucm/Midas_WM1811/init.state
|
||||||
|
# enable speaker for output and builtin mic for input
|
||||||
|
/usr/bin/alsaucm -c Midas_WM1811 set _verb HiFi set _enadev Speaker
|
||||||
|
/usr/bin/alsaucm -c Midas_WM1811 set _verb HiFi set _enadev Mic
|
||||||
|
fi
|
||||||
|
|
||||||
for c in /proc/asound/card[0-9]*; do
|
for c in /proc/asound/card[0-9]*; do
|
||||||
id=`cat $c/id`
|
id=`cat $c/id`
|
||||||
codec=`grep Codec: $c/codec* 2>/dev/null | head -n1`
|
codec=`grep Codec: $c/codec* 2>/dev/null | head -n1`
|
||||||
|
@ -1,32 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# console - virtual consoles plugin for postplug
|
# console - virtual consoles plugin for postplug
|
||||||
# Copyright (c) 2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (c) 2012-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
|
||||||
if [ $UID != 0 ]; then
|
grep "^KEYMAP=" /etc/vconsole.conf >/dev/null || {
|
||||||
echo "$0: must be superuser." >&2
|
KEYMAP="${LANG:0:2}"
|
||||||
exit 1
|
echo "KEYMAP=$KEYMAP" >> /etc/vconsole.conf
|
||||||
fi
|
}
|
||||||
|
|
||||||
TTYs=`grep "^[0-9]:" /etc/inittab | sed "s|.*\(tty[^[:space:]]*\).*|\1|"`
|
grep "^LANG=C$" /etc/locale.conf >/dev/null && \
|
||||||
|
sed -i "/^LANG=$/d" /etc/locale.conf
|
||||||
|
|
||||||
for t in $TTYs; do
|
grep "^LANG=" /etc/locale.conf >/dev/null || \
|
||||||
case $t in
|
echo "LANG=$LANG" >> /etc/locale.conf
|
||||||
tty[0-9]*)
|
|
||||||
[ -e /dev/tty ] && continue;
|
|
||||||
sed -i "s|\([0-9].*$t .*\)|#\1|" /etc/inittab
|
|
||||||
TTYchanged=1
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
tty*)
|
|
||||||
if [ ! -e /dev/$t -o "`setserial /dev/$t | grep 'UART: unknown' 2>/dev/null`" ]; then
|
|
||||||
sed -i "s|\([0-9].*$t .*\)|#\1|" /etc/inittab
|
|
||||||
TTYchanged=1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
[ "$TTYchanged" ] && telinit q
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# postplug - Postplug boot time configuration script
|
# postplug - Postplug boot time configuration script
|
||||||
# Copyright (c) 2004-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (c) 2004-2017 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
|
||||||
|
|
||||||
if [ $UID != 0 ]; then
|
if [ $UID != 0 ]; then
|
||||||
@ -14,7 +14,7 @@ me="${0##*/}"
|
|||||||
[ -r /etc/postplug/postplug.defs ] ||
|
[ -r /etc/postplug/postplug.defs ] ||
|
||||||
{ currtime="`LANG=C date +\"%b %d %H:%M:%S\" 2>/dev/null`"
|
{ currtime="`LANG=C date +\"%b %d %H:%M:%S\" 2>/dev/null`"
|
||||||
echo "\
|
echo "\
|
||||||
$currtime postplug: "$"error: "$"cannot read postplug.defs" >> $logfile
|
$currtime postplug: "$"error: "$"cannot read postplug.defs" >&2
|
||||||
exit 1; }
|
exit 1; }
|
||||||
|
|
||||||
. /etc/postplug/postplug.defs
|
. /etc/postplug/postplug.defs
|
||||||
@ -28,13 +28,8 @@ export POSTPLUGON=1
|
|||||||
# set homedir if not set (needed at boot time execution)
|
# set homedir if not set (needed at boot time execution)
|
||||||
[ "$HOME" ] || export HOME=/root
|
[ "$HOME" ] || export HOME=/root
|
||||||
|
|
||||||
logfile=/var/log/postplug.log
|
|
||||||
touch $logfile
|
|
||||||
|
|
||||||
logmsg "" $"starting"" ${me}"
|
logmsg "" $"starting"" ${me}"
|
||||||
|
|
||||||
export logfile
|
|
||||||
|
|
||||||
rm -f $postplugnewdir/*
|
rm -f $postplugnewdir/*
|
||||||
|
|
||||||
# check via /proc/cmdline for plugins that must not be executed
|
# check via /proc/cmdline for plugins that must not be executed
|
||||||
|
@ -7,11 +7,6 @@
|
|||||||
TEXTDOMAIN=postplug
|
TEXTDOMAIN=postplug
|
||||||
TEXTDOMAINDIR=/usr/share/locale
|
TEXTDOMAINDIR=/usr/share/locale
|
||||||
|
|
||||||
dialog_backtitle=$"Postplug"
|
|
||||||
DIALOG="dialog"
|
|
||||||
|
|
||||||
bootsplash_message=$"Configuring system hardware..."
|
|
||||||
|
|
||||||
postplugdir=/etc/postplug/postplug.d
|
postplugdir=/etc/postplug/postplug.d
|
||||||
rcpostplugdir=/etc/postplug/rcpostplug.d
|
rcpostplugdir=/etc/postplug/rcpostplug.d
|
||||||
postpluglibdir=/var/lib/postplug
|
postpluglibdir=/var/lib/postplug
|
||||||
@ -21,7 +16,7 @@ function logmsg() {
|
|||||||
local pluginame="${1:+ [$1]}"
|
local pluginame="${1:+ [$1]}"
|
||||||
local currtime="`LANG=C date +\"%b %d %H:%M:%S\" 2>/dev/null`"
|
local currtime="`LANG=C date +\"%b %d %H:%M:%S\" 2>/dev/null`"
|
||||||
|
|
||||||
if [ -w "$logfile" ]; then
|
if [ "$logfile" -a -w "$logfile" ]; then
|
||||||
echo "$currtime `hostname` postplug${pluginame}: $2" >> $logfile
|
echo "$currtime `hostname` postplug${pluginame}: $2" >> $logfile
|
||||||
else
|
else
|
||||||
echo "$currtime `hostname` postplug${pluginame}: $2"
|
echo "$currtime `hostname` postplug${pluginame}: $2"
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# postplug This shell script enables the automatic startup of postplug
|
|
||||||
# Author: Silvan Calarco <silvan.calarco@qilinux.it>
|
|
||||||
# chkconfig: 345 70 01
|
|
||||||
# description: Enable boot time execution of postplug
|
|
||||||
|
|
||||||
PROGNAME=/sbin/postplug
|
|
||||||
|
|
||||||
# source function library
|
|
||||||
. /etc/rc.d/init.d/functions
|
|
||||||
TEXTDOMAIN=postplug
|
|
||||||
TEXTDOMAINDIR=/usr/share/locale/
|
|
||||||
|
|
||||||
start() {
|
|
||||||
#echo -n "Starting $PROGNAME configuration tool: "
|
|
||||||
$PROGNAME
|
|
||||||
#echo
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
#echo -n "Stopping $PROGNAME configuration tool: "
|
|
||||||
# currently does nothing
|
|
||||||
#success
|
|
||||||
#(/bin/rm -f /var/lock/subsys/yum && success) || failure
|
|
||||||
#echo
|
|
||||||
:
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
[ -e /bin/plymouth ] && plymouth message --text=$"Configuring system..."
|
|
||||||
start
|
|
||||||
[ -e /bin/plymouth ] && plymouth message --text=$"Configuring system...done"
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stop
|
|
||||||
;;
|
|
||||||
restart)
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "*** Usage: $PROGNAME {start|stop|restart}"
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
14
postplug/postplug-service
Normal file
14
postplug/postplug-service
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=openmamba system configuration script
|
||||||
|
DefaultDependencies=no
|
||||||
|
After=systemd-udev-trigger.service systemd-remount-fs.service
|
||||||
|
Before=sysinit.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/sbin/postplug
|
||||||
|
TimeoutSec=90
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sysinit.target
|
@ -2,48 +2,89 @@
|
|||||||
#
|
#
|
||||||
# nVidia legacy test script
|
# nVidia legacy test script
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (c) 2007-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
# Released under the GNU GPL v.3 license
|
# Released under the GNU GPL v.3 license
|
||||||
#
|
#
|
||||||
|
|
||||||
|
[ "$1" = "-i" ] && DO_INSTALL=1
|
||||||
|
|
||||||
PCIID=`/usr/sbin/lspci -n | grep " 0300: 10de:" | awk '{ print $3 }'`
|
PCIID=`/usr/sbin/lspci -n | grep " 0300: 10de:" | awk '{ print $3 }'`
|
||||||
|
|
||||||
[ "$PCIID" ] || exit 0
|
[ "$PCIID" ] || exit 0
|
||||||
|
|
||||||
DEVID=${PCIID/*:/}
|
DEVID=`echo ${PCIID/*:/} | tr '[:lower:]' '[:upper:]'`
|
||||||
|
|
||||||
case $DEVID in
|
case $DEVID in
|
||||||
0020|0028|0029|002c|002d|\
|
0191|0193|0194|0197|019D|019E|0400|0401|0402|0403|\
|
||||||
00a0|0100|0101|0103|0150|\
|
0404|0405|0406|0407|0408|0409|040A|040B|040C|040D|\
|
||||||
0151|0152|0153) ALT_SUFFIX='_71xx' ;;
|
040E|040F|0410|0420|0421|0422|0423|0424|0425|0426|\
|
||||||
0110|0111|0112|0113|0170|\
|
0427|0428|0429|042A|042B|042C|042D|042E|042F|05E0|\
|
||||||
0171|0172|0173|0174|0175|\
|
05E1|05E2|05E3|05E6|05E7|05EA|05EB|05ED|05F8|05F9|\
|
||||||
0176|0177|0178|0179|017a|\
|
05FD|05FE|05FF|0600|0601|0602|0603|0604|0605|0606|\
|
||||||
017c|017d|0181|0182|0183|\
|
0607|0608|0609|060A|060B|060C|060D|060F|0610|0611|\
|
||||||
0185|0188|018a|018b|018c|\
|
0612|0613|0614|0615|0617|0618|0619|061A|061B|061C|\
|
||||||
01a0|01f0|0200|0201|0202|\
|
061D|061E|061F|0621|0622|0623|0625|0626|0627|0628|\
|
||||||
0203|0250|0251|0253|0258|\
|
062A|062B|062C|062D|062E|0630|0631|0632|0635|0637|\
|
||||||
0259|025b|0280|0281|0282|\
|
0638|063A|0640|0641|0643|0644|0645|0646|0647|0648|\
|
||||||
0286|0288|0289|028c) ALT_SUFFIX='_96xx' ;;
|
0649|064A|064B|064C|0651|0652|0653|0654|0655|0656|\
|
||||||
00FA|00FB|00FC|00FD|00FE|\
|
0658|0659|065A|065B|065C|06E0|06E1|06E2|06E3|06E4|\
|
||||||
0301|0302|0308|0309|0311|\
|
06E5|06E6|06E7|06E8|06E9|06EA|06EB|06EC|06EF|06F1|\
|
||||||
0312|0314|031A|031B|031C|\
|
06F8|06F9|06FA|06FB|06FD|06FF|0840|0844|0845|0846|\
|
||||||
0320|0321|0322|0323|0324|\
|
0847|0848|0849|084A|084B|084C|084D|084F|0860|0861|\
|
||||||
0325|0326|0327|0328|032A|\
|
0862|0863|0864|0865|0866|0867|0868|0869|086A|086C|\
|
||||||
032B|032C|032D|0330|0331|\
|
086D|086E|086F|0870|0871|0872|0873|0874|0876|087A|\
|
||||||
0332|0333|0334|0338|033F|\
|
087D|087E|087F|08A0|08A2|08A3|08A4|08A5|0A20|0A22|\
|
||||||
0341|0342|0343|0344|0347|\
|
0A23|0A26|0A27|0A28|0A29|0A2A|0A2B|0A2C|0A2D|0A32|\
|
||||||
0348|034C|034E) ALT_SUFFIX='_173xx' ;;
|
0A34|0A35|0A38|0A3C|0A60|0A62|0A63|0A64|0A65|0A66|\
|
||||||
|
0A67|0A68|0A69|0A6A|0A6C|0A6E|0A6F|0A70|0A71|0A72|\
|
||||||
|
0A73|0A74|0A75|0A76|0A78|0A7A|0A7C|0CA0|0CA2|0CA3|\
|
||||||
|
0CA4|0CA5|0CA7|0CA8|0CA9|0CAC|0CAF|0CB0|0CB1|0CBC|\
|
||||||
|
10C0|10C3|10C5|10D8) ALT_SUFFIX='340' ;;
|
||||||
|
|
||||||
|
0040|0041|0042|0043|0044|0045|0046|0047|0048|004E|\
|
||||||
|
0090|0091|0092|0093|0095|0098|0099|009D|00C0|00C1|\
|
||||||
|
00C2|00C3|00C8|00C9|00CC|00CD|00CE|00F1|00F2|00F3|\
|
||||||
|
00F4|00F5|00F6|00F8|00F9|0140|0141|0142|0143|0144|\
|
||||||
|
0145|0146|0147|0148|0149|014A|014C|014D|014E|014F|\
|
||||||
|
0160|0161|0162|0163|0164|0165|0166|0167|0168|0169|\
|
||||||
|
016A|01D0|01D1|01D2|01D3|01D6|01D7|01D8|01DA|01DB|\
|
||||||
|
01DC|01DD|01DE|01DF|0211|0212|0215|0218|0221|0222|\
|
||||||
|
0240|0241|0242|0244|0245|0247|0290|0291|0292|0293|\
|
||||||
|
0294|0295|0297|0298|0299|029A|029B|029C|029D|029E|\
|
||||||
|
029F|02E0|02E1|02E2|02E3|02E4|038B|0390|0391|0392|\
|
||||||
|
0393|0394|0395|0397|0398|0399|039C|039E|03D0|03D1|\
|
||||||
|
03D2|03D5|03D6|0531|0533|053A|053B|053E|07E0|07E1|\
|
||||||
|
07E2|07E3|07E5) ALT_SUFFIX='304' ;;
|
||||||
|
|
||||||
|
00FA|00FB|00FC|00FD|00FE|0301|0302|0308|0309|0311|\
|
||||||
|
0312|0314|031A|031B|031C|0320|0321|0322|0323|0324|\
|
||||||
|
0325|0326|0327|0328|032A|032B|032C|032D|0330|0331|\
|
||||||
|
0332|0333|0334|0338|033F|0341|0342|0343|0344|0347|\
|
||||||
|
0348|034C|034E) ALT_SUFFIX='173' ;;
|
||||||
|
|
||||||
|
0110|0111|0112|0113|0170|0171|0172|0173|0174|0175|\
|
||||||
|
0176|0177|0178|0179|017A|017C|017D|0181|0182|0183|\
|
||||||
|
0185|0188|018A|018B|018C|01A0|01F0|0200|0201|0202|\
|
||||||
|
0203|0250|0251|0253|0258|0259|025B|0280|0281|0282|\
|
||||||
|
0286|0288|0289|028C) ALT_SUFFIX='96' ;;
|
||||||
|
|
||||||
|
0020|0028|0029|002C|002D|00A0|0100|0101|0103|0150|\
|
||||||
|
0151|0152|0153) ALT_SUFFIX='71' ;;
|
||||||
|
|
||||||
*) ALT_SUFFIX='' ;;
|
*) ALT_SUFFIX='' ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -x /usr/sbin/update-alternatives-set-nvidia$ALT_SUFFIX ]; then
|
case $ALT_SUFFIX in
|
||||||
/usr/sbin/update-alternatives-set-nvidia$ALT_SUFFIX
|
340) REC_DRIVER='xorg-drv-video-nvidia_340' ;;
|
||||||
elif [ -x /usr/sbin/update-alternatives-set-dri ]; then
|
304) REC_DRIVER='xorg-drv-video-nvidia_304' ;;
|
||||||
/usr/sbin/update-alternatives-set-dri
|
173|96|71) REC_DRIVER='nouveau' ;;
|
||||||
else
|
*) REC_DRIVER='xorg-drv-video-nvidia' ;;
|
||||||
exit 1
|
esac
|
||||||
|
|
||||||
|
echo "NVIDIA recommended driver is $REC_DRIVER"
|
||||||
|
|
||||||
|
if [ "$DO_INSTALL" = "1" ]; then
|
||||||
|
rpm -q $REC_DRIVER || pkcon install $REC_DRIVER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
# add new detected non-removable disk partitions to /etc/fstab at boot time
|
# add new detected non-removable disk partitions to /etc/fstab at boot time
|
||||||
# (yes/no, default: yes)
|
# (yes/no, default: yes)
|
||||||
FS_PARTS_UPDATE=yes
|
FS_PARTS_UPDATE=no
|
||||||
|
|
||||||
# configure detected partitions for automatic mounting on boot
|
# configure detected partitions for automatic mounting on boot
|
||||||
# (yes/no, default: yes)
|
# (yes/no, default: yes)
|
||||||
FS_PARTS_MOUNT=yes
|
FS_PARTS_MOUNT=no
|
||||||
|
|
||||||
# dynamically add detected swap partitions to /etc/fstab at boot time
|
# dynamically add detected swap partitions to /etc/fstab at boot time
|
||||||
# (yes/no, default: yes)
|
# (yes/no, default: yes)
|
||||||
FS_SWAP_UPDATE=yes
|
FS_SWAP_UPDATE=no
|
||||||
|
|
||||||
# dinamically update the entries for /proc, /sys, devpts, tmpfs, usbfs
|
# dinamically update the entries for /proc, /sys, devpts, tmpfs, usbfs
|
||||||
# (yes/no, default: yes)
|
# (yes/no, default: yes)
|
||||||
@ -24,27 +24,42 @@ FS_CDROM_UPDATE=no
|
|||||||
|
|
||||||
# remove entries from /etc/fstab for non-existing devices
|
# remove entries from /etc/fstab for non-existing devices
|
||||||
# (yes/no, default: yes)
|
# (yes/no, default: yes)
|
||||||
FS_NO_DEV_REMOVE=yes
|
FS_NO_DEV_REMOVE=no
|
||||||
|
|
||||||
# run configuration wizard if a new network device is discovered
|
# network parameters for CDC ethernet interface
|
||||||
# (dialog/auto/off, default: off)
|
# (default: enabled)
|
||||||
NETWORK_NEWDEVICE=off
|
NETWORK_CDC_DISABLE=1
|
||||||
|
#NETWORK_CDC_IPADDR=10.99.99.1
|
||||||
|
#NETWORK_CDC_SUBNET=10.99.99.0
|
||||||
|
#NETWORK_CDC_RANGE_FROM=10.99.99.100
|
||||||
|
#NETWORK_CDC_RANGE_TO=10.99.99.199
|
||||||
|
#NETWORK_CDC_NETMASK=255.255.255.0
|
||||||
|
|
||||||
# xorg server: automatically add DRI section
|
# network parameters for Android rndis ethernet interface
|
||||||
# (on/off, default: on)
|
# (default: enabled)
|
||||||
XORG_ENABLE_DRI=on
|
NETWORK_ANDROID_DISABLE=1
|
||||||
|
#NETWORK_ANDROID_IPADDR=10.99.99.1
|
||||||
|
#NETWOKR_ANDROID_ETHADDR=01:02:03:04:05:06
|
||||||
|
#NETWORK_ANDROID_SUBNET=10.99.99.0
|
||||||
|
#NETWORK_ANDROID_RANGE_FROM=10.99.99.100
|
||||||
|
#NETWORK_ANDROID_RANGE_TO=10.99.99.199
|
||||||
|
#NETWORK_ANDROID_NETMASK=255.255.255.0
|
||||||
|
|
||||||
# xorg server: automatically enable 'Composite' extensions
|
# xorg server: add DRI section
|
||||||
# (on/off, default: off)
|
# (on/off, default: off)
|
||||||
XORG_ENABLE_COMPOSITE_EXT=on
|
#XORG_ENABLE_DRI=on
|
||||||
|
|
||||||
|
# xorg server: add Composite extension section
|
||||||
|
# (on/off, default: off)
|
||||||
|
#XORG_ENABLE_COMPOSITE_EXT=on
|
||||||
|
|
||||||
# xorg server: try to detect the screen size
|
# xorg server: try to detect the screen size
|
||||||
# (on/off, default: on)
|
# (on/off, default: on)
|
||||||
XORG_DETECT_SCREEN_SIZE=on
|
XORG_DETECT_SCREEN_SIZE=on
|
||||||
|
|
||||||
# kdm: enable Xgl server
|
# xorg server: power profile for Radeon driver
|
||||||
# (on/off, default: off)
|
# (auto/low/mid/high, default: mid)
|
||||||
KDM_ENABLE_XGL=off
|
#XORG_POWER_PROFILE=mid
|
||||||
|
|
||||||
# force sound card reconfiguration
|
# force sound card reconfiguration
|
||||||
# (on/off, default: off)
|
# (on/off, default: off)
|
||||||
|
7
udev/76-android_usb.rules
Normal file
7
udev/76-android_usb.rules
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# do not edit this file, it will be overwritten on update
|
||||||
|
|
||||||
|
ACTION!="add|change", GOTO="android_usb_probe_end"
|
||||||
|
|
||||||
|
SUBSYSTEM=="android_usb", KERNEL=="android*", IMPORT{program}="android_usb %p"
|
||||||
|
|
||||||
|
LABEL="android_usb_probe_end"
|
10
udev/android_usb
Executable file
10
udev/android_usb
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# FIXME: hardcoded values
|
||||||
|
if [ -e /sys$1 ]; then
|
||||||
|
ANDROID_STATE=`cat /sys$1/state`
|
||||||
|
[ "$ANDROID_STATE" = "CONFIGURED" ] || exit 0
|
||||||
|
|
||||||
|
ifup rndis0
|
||||||
|
touch /var/lib/dhcp/dhcpd-rndis0.leases
|
||||||
|
/sbin/dhcpd rndis0 -d -pf /run/dhcpd-rndis0.pid -cf /etc/dhcpd-rndis0.conf -lf /var/lib/dhcp/dhcpd-rndis0.leases
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user