Compare commits

...

85 Commits

Author SHA1 Message Date
cb4846db05 Release 1.5.2 2024-03-19 21:08:40 +01:00
7d4c087385 po: update translation files for recent gettext 2024-03-19 21:08:27 +01:00
62d4d51238 Makefile: update installation paths after usr/bin/sbin rootfs merge 2024-03-19 21:07:21 +01:00
ceafdd97e4 sysconfig/postplug: disable swap and vfs auto configuration in fstab 2024-03-19 21:06:54 +01:00
2d7f432a36 Release 1.5.1 2023-03-22 17:09:28 +01:00
c6bc954c16 xorg: remove creating obsolete configuration for synaptics driver 2023-03-22 17:08:17 +01:00
595e868cfa Release 1.5.0 2021-04-25 12:39:42 +02:00
dfb1a9f5cb Makefile: update systemd path; remove installation of update-alternatives-set-dri script 2021-04-25 12:39:18 +02:00
9f2d8e237b 30xorg: remove alternative mechanisms for NVIDIA following libglvnd; remove fglrx old driver support 2021-04-25 12:38:33 +02:00
d6cbd5326d Release 1.4.2 2020-12-21 19:53:03 +01:00
d739d6d3c6 Remove obsolete references to ncurses-dialog 2020-12-20 13:59:18 +01:00
4e0e3f5faf postplug.d/12loadconf: remove old script 2020-12-20 13:58:01 +01:00
c1105c976b Remove oldscripts folder 2020-12-20 13:56:30 +01:00
2777bff174 Release 1.4.1 (formerly released) 2020-12-20 13:54:32 +01:00
c3df1bc57d filesystems: disable automouting of swap partition if running live to fix installation with Calamares 2019-10-12 13:31:37 +02:00
a6acd7d48f Release 1.4.0 2017-12-20 14:38:11 +01:00
f8cf76e577 Install binaries under /usr/sbin instead of /sbin 2017-12-20 13:01:31 +01:00
67ba1a18c3 Log to stdout and stderr, no longer to /var/log/postplug.log 2017-12-20 12:58:27 +01:00
4d6ef8a665 Release 1.3.11 2016-11-07 20:31:15 +01:00
cf701ffc86 filesystems: set swap partitions timeout to avoid slow boot with systemd 2016-11-07 20:28:10 +01:00
6cda6f2788 Release 1.3.10 2015-08-16 12:19:10 +02:00
8965b60c8b postplug-service: add a TimeoutSec of 90 seconds 2015-08-15 21:02:27 +02:00
7fd882da85 filesystem: fix in blkid parsing 2015-06-16 15:14:09 +02:00
081784b702 Release 1.3.9 2015-05-23 15:35:42 +02:00
9ea0f12e60 update-alternatives-set-dri: update to new path of glx-dri/libglx.so 2015-05-23 15:34:06 +02:00
05e9f294ec Reelase 1.3.8 2015-05-23 15:33:30 +02:00
e80b4fc1a1 xorg: other infinite fixes for nvidia <-> nouveau switch with X -configure getting worse 2015-03-05 19:16:00 +01:00
be4dd98c7c nvidia-autoselect-driver: update with recent legacy drivers and support rpm installation 2015-03-05 17:50:44 +01:00
d567af8906 Release 1.3.7 2015-02-08 21:40:25 +01:00
1c1cd54ad6 update-alternatives-set-dir: make libdir parametric 2015-02-08 21:40:04 +01:00
ba52c3f82b Release 1.3.6 2015-01-17 19:04:18 +01:00
30f9d333d2 Disable by default removal of not found devices in /etc/fstab 2015-01-17 19:03:43 +01:00
22e6011467 Release 1.3.5 2014-12-31 13:06:58 +01:00
033a5b9c7e Merge branch 'master' of ssh://gitlab.mambasoft.it:4424/openmamba/postplug 2014-12-30 15:38:11 +01:00
2da377e6df Disable CDC and ANDROID usb0 device management by default (seen wrongly configuring on desktop client) 2014-12-30 15:37:03 +01:00
f3ef2574de Removed a line but just for a gitlab test 2014-12-22 14:49:11 +01:00
05c2d2cf43 30xorg: workaround configuration to disable DPMS on bananapi 2014-12-21 13:27:09 +01:00
97242a1b52 10filesystem: support for /dev/vd* devices as swap 2014-12-21 13:26:45 +01:00
81d0b9b78d Release 1.3.4 2014-12-06 15:46:41 +01:00
b4e152cfa7 update-alternatives-set-dri: libglx.so moved to xorg/modules/glx-dri directory 2014-12-06 15:42:48 +01:00
8a2ebd8df0 Release 1.3.3 2014-12-04 16:29:32 +01:00
df1571b7a6 Added update-alternatives-set-dri moved from xorg-server package 2014-12-04 16:29:01 +01:00
29e5202c60 Release 1.3.2 2014-10-03 18:51:03 +02:00
91d9c11c5e xorg: further fixes for radeon/fglrx switch 2014-10-03 18:50:17 +02:00
806b8138d5 Release 1.3.1 2014-10-03 13:40:42 +02:00
ed2bd4ff17 Remove sysv5 initscript 2014-10-03 13:40:25 +02:00
a75aae653e xorg: fixes for setting alternatives when switching from/to proprietary video drivers 2014-09-30 01:55:06 +02:00
2c2900db7d Release 1.3.0 2014-08-08 19:38:12 +02:00
7c2ebe3873 console: support multilanguage installation by post-configuring /etc/vconsole.conf and /etc/locale.conf 2014-08-08 19:11:01 +02:00
381aed1e7b xorg: try to set fixed video moves only when old CRT seem detected 2014-06-30 00:18:40 +02:00
2244f457a3 xorg: can't call localectl in postplug, so create 00-keyboard.conf 2014-06-30 00:13:38 +02:00
8598291d84 xorg: use localectl to configure X11 keyboard layout; ensure it is always configuring it 2014-06-29 19:56:04 +02:00
c87575239b Release 1.2.97 2014-06-29 19:55:10 +02:00
cc247c5237 xorg: don't add by default DRI and Composite sections, the last at least can prevent some drivers from starting (e.g. mga) 2014-06-12 18:05:04 +02:00
2e1ef68602 machine: exclude comment line starting with '#' from dmidecode output as seen on a HP Proliant Server 2014-06-11 21:18:41 +02:00
3a7c33f32b Release 1.2.96 2014-04-21 14:54:58 +02:00
f9e0066c8d Makefile: install systemd file without executable permissions 2014-04-21 14:54:42 +02:00
f6ec1e4476 Release 1.2.95 2013-11-19 11:01:46 +01:00
7f9aac7a35 network: rework android_usb support by using udev and avoid calling blocking systemctl for ttyG* but create symlinks 2013-11-19 10:59:44 +01:00
e42a6503e6 Release 1.2.94.1 2013-10-01 01:36:35 +02:00
a7fa2ad01e Makefile: remove bashism 2013-10-01 01:36:15 +02:00
0be567ca39 Release 1.2.94 2013-09-29 19:03:57 +02:00
9e035594d9 processor: fix to avoid reporting script execution error on log 2013-09-29 18:56:30 +02:00
29c1787405 filesystem: swap: yet another fix, add UUID= when calling swapon using uuid 2013-09-29 18:40:45 +02:00
f7e9e7befb filesystem: enable swap after adding to fstab 2013-09-29 18:35:08 +02:00
d18482236a filesystems: re-enable only for swap configuration; systemd service: start befare swap.target 2013-09-26 14:26:55 +02:00
c7a0828eaa Release 1.2.93 2013-09-19 12:31:22 +02:00
fdfb337dcb network: remove trailing spacing when setting HWADDR for ifcfg-p2p0 for NetworkManager to parse it correctly 2013-09-19 02:30:06 +02:00
29ea391692 network: enable getty on ttyGS0,1 through systemd to enable ACM console on android_usb 2013-09-19 02:00:46 +02:00
94b6db3676 network: code optimization for speed and removal/cornering of obsolete functions 2013-09-18 20:10:00 +02:00
57701f3c38 Release 1.2.92 2013-09-18 02:03:19 +02:00
7a526dab3a xorg: remove obsoleted code and rework caching for autoprobed devices to speed up boot 2013-09-18 02:01:19 +02:00
95b7da8f5b sound: don't probe raspberry-pi sound module, now using an alias since libalsa 1.0.27.2-4mamba
- rework checks on cached (unchanged) devices to speed up boot in rpi and sgn
2013-09-18 01:58:48 +02:00
a3d787b75c Release 1.2.91 2013-07-31 15:17:41 +02:00
dccee1c9dd network: configure and start a dedicated dhcpd server bound to configured CDC and RNDIS interfaces 2013-07-31 14:35:17 +02:00
8740e2a830 network: added support for configuration of CDC-Ethernet and Android RNDIS network interfaces 2013-07-31 13:28:01 +02:00
b011e2aa40 network: removed obsolete code for interactive boot-time configuration using dialog 2013-07-31 12:10:54 +02:00
10aa2ca3ee sound: add support for initial mixer configuration of Midas_WM1811 (Galaxy Note 10.1) 2013-07-30 18:21:48 +02:00
c2a12f57be Revert "filesystems: re-enable with systemd because installer needs mounted entries"
This is not really needed and would cause problems with systemd.

This reverts commit a6f03cc4b3.
2013-06-28 22:14:48 +02:00
a6f03cc4b3 filesystems: re-enable with systemd because installer needs mounted entries 2013-06-11 15:15:37 +02:00
7cd0c08d6b Release 1.2.90 2013-04-05 14:56:21 +02:00
9f585a34c9 xorg: fix when nouveau/modeset is returning -1 instead of 1 (treat as 1) 2013-04-05 14:54:33 +02:00
97a897b29e postplug-service: run after fs remount and before sysinit.target 2013-04-05 14:51:14 +02:00
f8beae5cbe localtime: create /etc/localtime as a symlink as required by systemd (and also good for sysv5) 2013-04-05 14:23:43 +02:00
d6e8096815 postplug: add systemd service script and don't run filesystem and console scripts if systemd is running 2013-04-05 14:19:03 +02:00
24 changed files with 525 additions and 898 deletions

1
BUGS
View File

@ -1,2 +1 @@
- the scripts localtime and xorg should have a timeout
- the script filesystems should delete the unused directories found in /mnt

View File

@ -1,22 +1,25 @@
# 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>
include VERSION
PACKAGE = postplug
prefix = /usr
exec_prefix = $(prefix)
sysconfdir = /etc
prefix := /usr
exec_prefix := $(prefix)
sysconfdir := /etc
bindir = $(exec_prefix)/bin
sbindir = $(exec_prefix)/sbin
sbin = /sbin
libdir := $(prefix)/lib
sbindir := $(bindir)
sbin := $(bindir)
mandir = $(prefix)/share/man
datadir = $(prefix)/share
initrddir = $(sysconfdir)/rc.d/init.d
logrotatedir = $(sysconfdir)/logrotate.d/
sysconfigdir= $(sysconfdir)/sysconfig
systemdunitdir := $(prefix)/lib/systemd/system
udevdir := $(prefix)/lib/udev
udevrulesdir := $(udevdir)/rules.d
localesdir = $(datadir)/locale
srcdir = .
@ -42,7 +45,6 @@ pck_catalogs := $(wildcard po/*.po)
pck_plugins := $(wildcard postplug.d/*)
pck_sysconfig := $(wildcard sysconfig/*)
pck_defs := postplug/postplug-defs
pck_initscript = postplug/postplug-initscript
pck_logrotate = postplug/postplug-logrotate
pck_postplug = postplug/postplug
pck_scripts := $(wildcard scripts/*)
@ -61,7 +63,7 @@ install-locales: locales
echo "installing i18n file for language \`$$lang'...";\
dir="$(DESTDIR)$(localesdir)/$$lang/LC_MESSAGES";\
$(INSTALL_DIR) $$dir;\
$(INSTALL_DATA) $${f/.po/.mo} $$dir/$(PACKAGE).mo;\
$(INSTALL_DATA) po/$$lang.mo $$dir/$(PACKAGE).mo;\
done
install-defs: $(pck_defs)
@ -69,10 +71,10 @@ install-defs: $(pck_defs)
$(INSTALL_DIR) $(DESTDIR)$(postplugdefsdir)
$(INSTALL_DATA) $^ $(DESTDIR)$(postplugdefsdir)/$(PACKAGE).defs
install-initscript: $(pck_initscript)
install-initscript:
@echo "installing initscript...";\
$(INSTALL_DIR) $(DESTDIR)$(initrddir)
$(INSTALL_SCRIPT) $^ $(DESTDIR)$(initrddir)/$(PACKAGE)
$(INSTALL_DIR) $(DESTDIR)$(systemdunitdir)
$(INSTALL_DATA) postplug/postplug-service $(DESTDIR)$(systemdunitdir)/postplug.service
install-logrotate: $(pck_logrotate)
@echo "installing logrotate file...";\
@ -91,19 +93,25 @@ install-plugins: $(pck_plugins)
$(DESTDIR)$(postplugrcdir)/$$plugin;\
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_DIR) $(DESTDIR)$(sysconfigdir)
$(INSTALL_DATA) $^ $(DESTDIR)$(sysconfigdir)
install-scripts: $(pck_scripts)
@echo "installing logrotate file...";\
$(INSTALL_DIR) $(DESTDIR)$(sbin)
$(INSTALL_SCRIPT) $^ $(DESTDIR)$(sbin)
$(INSTALL_DIR) $(DESTDIR)$(sbindir)
$(INSTALL_SCRIPT) $^ $(DESTDIR)$(sbindir)
install-programs: install-plugins install-scripts install-defs
@echo "installing $(PACKAGE)..."
@$(INSTALL_DIR) $(DESTDIR)$(sbin)
$(INSTALL_SCRIPT) $(pck_postplug) $(DESTDIR)$(sbin)/$(PACKAGE)
@$(INSTALL_DIR) $(DESTDIR)$(sbindir)
$(INSTALL_SCRIPT) $(pck_postplug) $(DESTDIR)$(sbindir)/$(PACKAGE)
$(INSTALL_DIR) $(DESTDIR)$(postplugnewdir)
install: \
@ -111,17 +119,18 @@ install: \
install-initscript \
install-logrotate \
install-locales \
install-sysconfig
install-sysconfig \
install-udev-files
uninstall:
rm -f $(DESTDIR)$(sbin)/$(PACKAGE)
rm -f $(DESTDIR)$(sbindir)/$(PACKAGE)
for f in $(notdir $(pck_plugins)); do\
rm -f $(DESTDIR)$(postplugdir)/$${f##[0-9][0-9]};\
rm -f $(DESTDIR)$(postplugrcdir)/$$f;\
done
-rmdir $(DESTDIR)$(postplugdir)
-rmdir $(DESTDIR)$(postplugrcdir)
rm -f $(DESTDIR)$(initrddir)/$(PACKAGE)
rm -f $(DESTDIR)$(systemdunitdir)/postplug.service
rm -f $(DESTDIR)$(localesdir)/*/LC_MESSAGES/$(PACKAGE).mo
dist: clean

View File

@ -1 +1 @@
VERSION = 1.2.21
VERSION = 1.5.2

View File

@ -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

View File

@ -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

View File

@ -4,6 +4,20 @@
#: 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
#

View File

@ -4,6 +4,20 @@
#: 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
#

View File

@ -11,7 +11,7 @@ function getdmivar() {
local dmivalue
[ $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
return 0
}

View File

@ -7,12 +7,11 @@
[ -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|" `
if [ "`echo $CPUMODEL | grep AMD`" ]; then
CPUMODEL=`cat /proc/cpuinfo | grep "model name" -m1 | sed "s|model name[[:space:]*]:\(.*\)|\1|" `
if [ "`echo $CPUMODEL | grep AMD`" ]; then
CPUVENDOR=AMD
if [ "`echo $CPUMODEL | grep X2`" ]; then
LOAD_MODULE=powernow_k8
@ -23,14 +22,9 @@
else
LOAD_MODULE=acpi_cpufreq
fi
elif [ "`echo $CPUMODEL | grep Intel`" ]; then
elif [ "`echo $CPUMODEL | grep Intel`" ]; then
CPUVENDOR=Intel
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
}
fi
[ -e /etc/sysconfig/acpi ] && sed -i "/CPU_FREQ=.*/d" /etc/sysconfig/acpi
echo "CPU_FREQ=$LOAD_MODULE" >> /etc/sysconfig/acpi

View File

@ -3,7 +3,7 @@
# filesystems - filesystems plugin for postplug
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@qilinux.it>
# 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
echo "$0: must be superuser." >&2
@ -72,6 +72,10 @@ ${dir/[0-9]*/}$((${dir/$mp_suffix/}+1))" ;;
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` ||
{ 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]\* \
#\) -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 :(
grep -q "/proc" $fstab 2>/dev/null ||
{ echo "proc /proc proc defaults 0 0" >> $fstab
@ -121,7 +125,7 @@ if [ "$FS_VFS_UPDATE" != no ]; then
fi
if [ "$FS_NO_DEV_REMOVE" = yes ]; then
if [ "$FS_NO_DEV_REMOVE" = "yes" ]; then
[ -e $fstab ] && cp $fstab $tmpfstab || touch $fstab
while read fs mount_point fstype options dump fsck_order ignore; do
case $fs in
@ -160,12 +164,14 @@ let "swapon = 0"
# scan for new devices using the searching mask `$devs2scan'
[[ "$FS_PARTS_MOUNT" = "yes" ]] && AUTO_ADD="" || AUTO_ADD="noauto,"
[[ "$FS_PARTS_UPDATE" = no && "$FS_SWAP_UPDATE" = no ]] ||
blkid | grep /dev/sd | while read line; do
# disable automounting of swap partition if live to fix Calamares installation
[ -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
dev=${line/:*}
devline=${line/*:}
dev=${line/: *}
devline=${line/*: }
eval $devline
label=$LABEL
devfstype=$TYPE
@ -191,11 +197,13 @@ blkid | grep /dev/sd | while read line; do
check_options="0 0"
case $dev in
/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)
;;
/dev/cdrom[0-9]*) # CDROM devices
[ "$FS_CDROM_UPDATE" = yes ] || continue
/dev/sr[0-9]*|\
/dev/cdrom[0-9]*)
# CDROM devices
[ "$FS_CDROM_UPDATE" = "yes" ] || continue
# check if the CD is already mounted
devfs="$(readlink -f $dev)"
mount | \
@ -210,7 +218,9 @@ blkid | grep /dev/sd | while read line; do
mount_point=$(get_new_mp_name cdrom)
;;
/dev/sd[a-z][0-9]*|\
/dev/vd[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]*/part[0-9]*)
## 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}" )
case $devfstype in
linux-swap|swap) # Linux swap
[ "$FS_SWAP_UPDATE" = yes ] || continue
[ "$FS_SWAP_UPDATE" = "yes" ] || continue
mount_point="swap "
fstype="swap"
options="pri=1"
options="pri=1,nofail,x-systemd.device-timeout=4"
let "swapon = 1" ;;
ext*|reiserfs|reiser4) # Linux partition
[ "$FS_PARTS_UPDATE" = yes ] || continue
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
mount_point=$(get_new_mp_name "$label" $dev)
if [[ "$mount_point" = "/" ]]; then
# found a root partition already mounted but not in fstab!
@ -248,7 +258,7 @@ blkid | grep /dev/sd | while read line; do
fi
options="defaults,noatime" ;;
ntfs|hpfs) # HPFS/NTFS
[ "$FS_PARTS_UPDATE" = yes ] || continue
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
mount_point=$(get_new_mp_name "$label" $dev)
if [ -x /sbin/mount.ntfs-3g ]; then
fstype="ntfs-3g"
@ -258,17 +268,17 @@ blkid | grep /dev/sd | while read line; do
options="${AUTO_ADD}user,ro,gid=32,umask=002"
fi ;;
fat12|fat16|fat32|FAT|vfat)
[ "$FS_PARTS_UPDATE" = yes ] || continue
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
# FAT12, FAT16<32M, FAT16, FAT16 [LBA]
# FAT32 [LBA]
mount_point=$(get_new_mp_name "$label" $dev)
options="${AUTO_ADD}user,gid=32,umask=002" ;;
hfs|hfs+|hfsplus)
[ "$FS_PARTS_UPDATE" = yes ] || continue
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
mount_point=$(get_new_mp_name "$label" $dev)
options="${AUTO_ADD}user" ;;
# f) # W95 Ext'd (LBA)
# [ "$FS_PARTS_UPDATE" = yes ] || continue
# [ "$FS_PARTS_UPDATE" = "yes" ] || continue
# unset nblocks
# nblocks=$( echo $(grep ${dev/\/dev\//} /proc/partitions) | \
# cut -d" " -f3 )
@ -276,7 +286,7 @@ blkid | grep /dev/sd | while read line; do
# mount_point=$(get_new_mp_name "$label")
# options="${AUTO_ADD}user,gid=32,umask=002" ;;
*) # ignore unknown partitions
[ "$FS_PARTS_UPDATE" = yes ] || continue
[ "$FS_PARTS_UPDATE" = "yes" ] || continue
logmsg "$me" $"ignoring unknown partition (id:$devfstype)"
continue ;;
esac
@ -285,9 +295,6 @@ blkid | grep /dev/sd | while read line; do
;;
esac
logmsg "$me" $"\
added device \`$dev' (${uuid}) mount point:\`$mount_point'"
# note: if 'mount_point' is yet undefined there is a bug
if [[ "$mount_point" ]]; then
# default values: fstype="auto", options="noauto,user"
@ -296,25 +303,27 @@ added device \`$dev' (${uuid}) mount point:\`$mount_point'"
echo "\
UUID=${uuid} $mount_point \
${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab
[ "$fstype" = "swap" ] && /sbin/swapon -p 1 UUID=${uuid}
else
echo "\
$dev $mount_point \
${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab
[ "$fstype" = "swap" ] && /sbin/swapon -p 1 ${dev}
fi
# create the mount point and mount the new device
[ "${mount_point:0:${#rootmp}}" = "${rootmp}" ] && {
mkdir -p "$mount_point"
mount "$mount_point"
}
logmsg "$me" $"\
added device \`$dev' (${uuid}) mount point:\`$mount_point'"
fi
fi
done
grep "[[:space:]]/[[:space:]].*ext[2-9].*defaults[[:space:]]" /etc/fstab >/dev/null && {
logmsg "$me" $"enabling \`noatime' option for root filesystem"
sed -i "s|\([[:space:]]/[[:space:]].*ext[2-9].*defaults\)\([[:space:]]\)|\1,noatime\2|" /etc/fstab
mount -o remount /
grep "[[:space:]]/[[:space:]].*ext[2-9].*defaults,noatime[[:space:]]" /etc/fstab >/dev/null && {
logmsg "$me" $"disabling \`noatime' option for root filesystem (previously added by postplug)"
sed -i "s|\([[:space:]]/[[:space:]].*ext[2-9].*defaults\),noatime|\1|" /etc/fstab
}
[ "$swapon" = 1 ] && swapon -a
exit 0

View File

@ -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

View File

@ -1,6 +1,6 @@
#!/bin/bash
# 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>
if [ $UID != 0 ]; then
@ -8,7 +8,7 @@ if [ $UID != 0 ]; then
exit 1
fi
[ -f /etc/localtime ] && exit 0
[ -e /etc/localtime ] && exit 0
me="localtime"
@ -21,12 +21,16 @@ logmsg "$me" $"creating /etc/timezone and /etc/localtime files..."
# FIXME
case "$LANG" in
es_*)
echo "Europe/Madrid" > /etc/timezone
ln -sf $ZONEINFODIR/Europe/Madrid /etc/localtime
;;
it_*)
echo "Europe/Rome" > /etc/timezone
cp -f $ZONEINFODIR/Europe/Rome /etc/localtime
ln -sf $ZONEINFODIR/Europe/Rome /etc/localtime
;;
*) echo "GMT" > /etc/timezone
cp -f $ZONEINFODIR/GMT /etc/localtime
ln -sf $ZONEINFODIR/GMT /etc/localtime
;;
esac

View File

@ -3,7 +3,7 @@
# network - network plugin for postplug
#
# 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
@ -15,9 +15,6 @@ me="network"
. /etc/postplug/postplug.defs
postplugnew_file=$postplugnewdir/network
rm -f $postplugnew_file
[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug
[ -r /etc/sysconfig/rc ] && . /etc/sysconfig/rc
@ -57,225 +54,133 @@ _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() {
# eth_config {--enable|--disable|--auto} <int_name>
ifconfig usb0 &>/dev/null && {
[ "$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" -- "$@"`
[[ $? = 0 ]] || return 1
function android_usb() {
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
while :; do
case $1 in
-e|--enable)
action="enable" ;;
-d|--disable)
action="disable" ;;
-a|--auto)
action="auto" ;;
--) shift; break ;;
*) logmsg "$me" "FIXME: "$"\`getopt' error"
exit 1
;;
esac
shift
[ -e $network_devices/ifcfg-rndis0 ] || {
[ "$NETWORK_ANDROID_IPADDR" ] && ANDROID_IPADDR=$NETWORK_ANDROID_IPADDR
cat > $network_devices/ifcfg-rndis0 << _EOF
DEVICE=rndis0
BOOTPROTO=none
IPADDR=$ANDROID_IPADDR
NETMASK=$ANDROID_NETMASK
ONBOOT=yes
NM_CONTROLLED=no
_EOF
}
[ -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
}
local eth_interface="$1"
[ "$NETWORK_CDC_DISABLE" = "1" ] || cdc_usb
[ "$NETWORK_ANDROID_DISABLE" = "1" ] || android_usb
[ "$eth_interface" ] ||
{ logmsg "$me" "FIXME: "$"no interface set"
exit 1; }
# 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
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}
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
_EOF
return
fi
$DIALOG --colors \
--backtitle "\
$dialog_backtitle -- "$"Network devices configuration" \
--title $" LAN INTERFACE CONFIGURATION " \
--yesno "
"$"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
NM_CONTROLLED=no
_EOF
fi
}
done
# 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
# 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"
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
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"
echo "$eth_int" >> $postplugnew_file 2>/dev/null
done
done
# how many interface have been configured?
let "int_newconf = 0"
# how many interface have been configured?
let "int_newconf = 0"
if [ ${#eth_ints[*]} -gt 0 ]; then
if [ ${#eth_ints[*]} -gt 0 ]; then
case "$NETWORK_NEWDEVICE" in
"auto")
for eth_int in ${eth_ints[*]}; do
@ -284,34 +189,6 @@ if [ ${#eth_ints[*]} -gt 0 ]; then
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"
done ;;
1) # disable all the ethernet interfaces
for eth_int in ${eth_ints[*]}; do
eth_config --disable $eth_int
done
exit ;;
*) : ;; # timeout (code = 255)
esac
;;
"off"|"")
exit
;;
@ -320,10 +197,9 @@ illegal value for NETWORK_NEWDEVICE ($NETWORK_NEWDEVICE)"
exit 1
;;
esac
fi
fi
if [ ${#wlan_ints[*]} -gt 0 ]; then
# FIXME: wlan dialog support is missing
if [ ${#wlan_ints[*]} -gt 0 ]; then
case "$NETWORK_NEWDEVICE" in
"auto")
for wlan_int in ${wlan_ints[*]}; do
@ -333,47 +209,7 @@ if [ ${#wlan_ints[*]} -gt 0 ]; then
exit
;;
esac
fi
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

View File

@ -1,6 +1,6 @@
#!/bin/bash
# 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>
if [ $UID != 0 ]; then
@ -18,8 +18,6 @@ me="xorg"
XORGCONF=/etc/X11/xorg.conf
kernel_min=$(uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,')
# xorg_section_screen_config()
# write a new xorg configuration
# args:
@ -48,53 +46,21 @@ function xorg_section_screen_config() {
mv $XORGCONF.new $XORGCONF
}
# xorg_set_alternatives()
# set alternatives and xorg configuration for specific video drivers
function xorg_set_alternatives() {
if [ "$VIDEODRIVER" = "nvidia" ]; then
grep -q '^[^#]*\"AllowGLXWithComposite\"' $XORGCONF ||
sed -i -e '/Driver\W*"nvidia"/a\
Option \"RenderAccel\" \"true\"\
Option \"AllowGLXWithComposite\" \"on\"\
Option \"NoLogo\" \"true\"' $XORGCONF
# 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
}
}
## xorg_set_alternatives()
## set alternatives and xorg configuration for specific video drivers
#function xorg_set_alternatives() {
#if [ "$VIDEODRIVER" = "nvidia" ]; then
# grep -q '^[^#]*\"AllowGLXWithComposite\"' $XORGCONF ||
# sed -i -e '/Driver\W*"nvidia"/a\
# Option \"RenderAccel\" \"true\"\
# Option \"AllowGLXWithComposite\" \"on\"\
# Option \"NoLogo\" \"true\"' $XORGCONF
#fi
#}
function xorg_d_configure_input() {
# Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d)
[ ! -e /etc/X11/xorg.conf.d/10-keyboard.conf -o \
/etc/sysconfig/keyboard -nt /etc/X11/xorg.conf.d/10-keyboard.conf ] && {
[ ! -e /etc/X11/xorg.conf.d/00-keyboard.conf ] && {
if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then
case "${LANG:0:2}" in
@ -116,48 +82,28 @@ function xorg_d_configure_input() {
esac
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"
Identifier "Keyboard Defaults"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Driver "evdev"
Option "XkbLayout" "$XKB_LAYOUT"
__EOF
[ "$XKB_MODEL" ] && echo " Option \"XkbModel\" \"$XKB_MODEL\"" >>/etc/X11/xorg.conf.d/10-keyboard.conf
[ "$XKB_VARIANT" ] && echo " Option \"XkbVariant\" \"$XKB_VARIANT\"" >>/etc/X11/xorg.conf.d/10-keyboard.conf
[ "$XKB_OPTIONS" ] && echo " Option \"XkbOptions\" \"$XKB_OPTIONS\"" >>/etc/X11/xorg.conf.d/10-keyboard.conf
echo "EndSection" >>/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/00-keyboard.conf
if [ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ]; then
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 [ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ]; then
cat > /etc/X11/xorg.conf.d/15-keyboard-apple.conf << __EOF
Section "InputClass"
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
if [ -e /etc/X11/xorg.conf.d/10-keyboard.conf ]; then
rm -f /etc/X11/xorg.conf.d/10-keyboard.conf
fi
if [ -e /etc/X11/xorg.conf.d/15-keyboard-apple.conf ]; then
rm -f /etc/X11/xorg.conf.d/15-keyboard-apple.conf
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
@ -169,6 +115,7 @@ if [ -e /dev/nvhost-ctrl ]; then
VIDEO_DEV="NVIDIA TEGRA"
else
VIDEO_DEV="`lspci -n 2>/dev/null | grep " 03[0-9][0-9]: "`"
[ "$VIDEO_DEV" ] || VIDEO_DEV="embedded-unknown"
fi
if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then
@ -185,28 +132,22 @@ if [ -e $XORGCONF ]; then
VIDEODRIVER=${VIDEODRIVERS[0]}
[ -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`
[ "$RADEON_MODESET" = "-1" ] && RADEON_MODESET=1
if [ "$VIDEODRIVER" = "nvidia" -a "$NOUVEAU_MODESET" = "1" ]; then
# replace nvidia with nouveau
mv $XORGCONF $XORGCONF.postplug.nvidia.save
rmmod nvidia
echo "blacklist nvidia" > /etc/modprobe.d/postplug-nouveau.conf
elif [ "$VIDEODRIVER" = "nouveau" -a "$NOUVEAU_MODESET" != "1" ]; then
# replace nouveau with nvidia
VIDEODRIVER=""
elif [ "$NOUVEAU_MODESET" = "0" ]; then
# replace nouveau with nvidia (NOUVEAU_MODESET=0 means we have nvidia chip)
mv $XORGCONF $XORGCONF.postplug.nouveau.save
rmmod nouveau
rm -f /etc/modprobe.d/postplug-nouveau.conf
elif [ "$VIDEODRIVER" = "fglrx" -a "$RADEON_MODESET" = "1" ]; then
# 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
VIDEODRIVER="nvidia"
fi
fi
@ -218,34 +159,22 @@ if [ ! -e $XORGCONF ]; then
# use default xorg.conf for Tegra
cp $XORGCONF.tegra $XORGCONF
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
[ "`/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
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=$?
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"
VIDEO_DEV="autoprobe"
echo "# Dummy empty xorg.conf file created by postplug" > $XORGCONF
xorg_configure_loginmanager
xorg_d_configure_input
exit 1
else
mv /tmp/xorg.conf.new $XORGCONF
sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF
@ -254,72 +183,21 @@ if [ ! -e $XORGCONF ]; then
fi
fi
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
DISPLAYSIZE="`sed -n "/Section[ \t]\"Monitor\"/,/EndSection/{s/[ \t]*DisplaySize[ \t]*\(.*\)/\1/p}" $XORGCONF`"
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
if [ "$CONFCREATED" = "1" -a "$VIDEODRIVER" ]; then
[ "`grep nomodeset /proc/cmdline`" ] && nomodeset=1
if [ "$nomodeset" = "1" -a "$VIDEODRIVER" = "nouveau" ]; then
sed -i "s|Driver\W*\"nouveau\"|Driver \"nvidia\"|" $XORGCONF
VIDEODRIVER=nvidia
xorg_set_alternatives
rmmod nouveau nvidia
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
vesa|vga) sed -i -e '/Section "Screen"/a\
#DefaultColorDepth 24' $XORGCONF ;;
@ -407,15 +285,13 @@ if [ "$CONFCREATED" = "1" ]; then
# echo "$XORGCONF" > $postplugnew_file
xorg_set_alternatives
# Final probe
[ -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
xinit /bin/true -- :5 2>>$logfile
xinit /bin/true -- :5
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
}
[ "$PANEL_SIZE_DETECTED" ] ||
[ "$HSYNC_RANGE_NOT_DETECTED" -a ! "$PANEL_SIZE_DETECTED" ] &&
sed -i -e '/SubSection "Display"/a\
Modes "1024x768" "800x600" "640x480"' $XORGCONF
else
@ -480,6 +356,9 @@ warning: DDC hsync range cannot be detected, setting default of 30-49 kHz"
fi
fi
[ "$VIDEO_DEV" -a "$VIDEO_DEV" != "$VIDEO_DEV_CACHED" ] &&
echo "$VIDEO_DEV" > $postpluglibdir/xorg.cache
####################################
#
# Xorg dynamic configuration section
@ -488,41 +367,68 @@ fi
# radeon: enable a conservative power profile (mid) by default
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
[ -e $XORGCONF ] || {
logmsg "$me" "error: "$"missing Xorg configuration file; aborting"
exit 1
}
# Configure keyboard
xorg_d_configure_input
# configure inittab for login manager
xorg_configure_loginmanager
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
# 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
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...
# remove wrong configuration for USBMouse (duplicating PS2MOUSE)
@ -539,16 +445,10 @@ sed -i "/\W*Option \"Device\".*/d" $XORGCONF
# remove obsoleted XAANoOffscreenPixmaps
sed -i '/^[[:space:]]*Option[[:space:]]*"XAANoOffscreenPixmaps" "true"/d' $XORGCONF
# Configure keyboard
xorg_d_configure_input
# disable keyboard configuration for Xorg >= 1.4
sed -i "s|^\([[:space:]]*InputDevice\W*\"Keyboard0\".*\)|#\1|" $XORGCONF
# FIXME: delete empty lines
sed -i '/./,$!d' $XORGCONF
[ "$CONFCREATED" = "1" -o ! -e $postpluglibdir/xorg.cache ] && \
echo "$VIDEO_DEV" > $postpluglibdir/xorg.cache
exit 0

View File

@ -2,7 +2,7 @@
#
# sound - sound configuration plugin for postplug
# 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
@ -14,15 +14,10 @@ fi
me="sound"
[ -r /etc/sysconfig/machine ] && . /etc/sysconfig/machine
. /etc/postplug/postplug.defs
[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug
SYSCONFIG_SOUNDCARDS=/etc/sysconfig/soundcards
[ -e /etc/asound.state ] && rm -f /etc/asound.state
# set default mixer volumes
function set_mixers() {
[ -x /usr/bin/amixer ] || return
@ -84,16 +79,6 @@ if [ ! "$SOUND_DEV" ]; then
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 [ -e $postpluglibdir/sound.cache ]; then
SOUND_DEV_CACHED="`cat $postpluglibdir/sound.cache`"
@ -103,7 +88,17 @@ if [ "$SOUND_FORCE_RESCAN" != "on" -a "$SOUND_FORCE_RESCAN" != "1" ]; then
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
id=`cat $c/id`
codec=`grep Codec: $c/codec* 2>/dev/null | head -n1`

View File

@ -1,32 +1,16 @@
#!/bin/bash
# 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
echo "$0: must be superuser." >&2
exit 1
fi
grep "^KEYMAP=" /etc/vconsole.conf >/dev/null || {
KEYMAP="${LANG:0:2}"
echo "KEYMAP=$KEYMAP" >> /etc/vconsole.conf
}
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
case $t in
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
grep "^LANG=" /etc/locale.conf >/dev/null || \
echo "LANG=$LANG" >> /etc/locale.conf
exit 0

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# 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>
if [ $UID != 0 ]; then
@ -14,7 +14,7 @@ me="${0##*/}"
[ -r /etc/postplug/postplug.defs ] ||
{ currtime="`LANG=C date +\"%b %d %H:%M:%S\" 2>/dev/null`"
echo "\
$currtime postplug: "$"error: "$"cannot read postplug.defs" >> $logfile
$currtime postplug: "$"error: "$"cannot read postplug.defs" >&2
exit 1; }
. /etc/postplug/postplug.defs
@ -28,13 +28,8 @@ export POSTPLUGON=1
# set homedir if not set (needed at boot time execution)
[ "$HOME" ] || export HOME=/root
logfile=/var/log/postplug.log
touch $logfile
logmsg "" $"starting"" ${me}"
export logfile
rm -f $postplugnewdir/*
# check via /proc/cmdline for plugins that must not be executed

View File

@ -7,11 +7,6 @@
TEXTDOMAIN=postplug
TEXTDOMAINDIR=/usr/share/locale
dialog_backtitle=$"Postplug"
DIALOG="dialog"
bootsplash_message=$"Configuring system hardware..."
postplugdir=/etc/postplug/postplug.d
rcpostplugdir=/etc/postplug/rcpostplug.d
postpluglibdir=/var/lib/postplug
@ -21,7 +16,7 @@ function logmsg() {
local pluginame="${1:+ [$1]}"
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
else
echo "$currtime `hostname` postplug${pluginame}: $2"

View File

@ -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
View 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

View File

@ -2,48 +2,89 @@
#
# 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
#
[ "$1" = "-i" ] && DO_INSTALL=1
PCIID=`/usr/sbin/lspci -n | grep " 0300: 10de:" | awk '{ print $3 }'`
[ "$PCIID" ] || exit 0
DEVID=${PCIID/*:/}
DEVID=`echo ${PCIID/*:/} | tr '[:lower:]' '[:upper:]'`
case $DEVID in
0020|0028|0029|002c|002d|\
00a0|0100|0101|0103|0150|\
0151|0152|0153) ALT_SUFFIX='_71xx' ;;
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='_96xx' ;;
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='_173xx' ;;
0191|0193|0194|0197|019D|019E|0400|0401|0402|0403|\
0404|0405|0406|0407|0408|0409|040A|040B|040C|040D|\
040E|040F|0410|0420|0421|0422|0423|0424|0425|0426|\
0427|0428|0429|042A|042B|042C|042D|042E|042F|05E0|\
05E1|05E2|05E3|05E6|05E7|05EA|05EB|05ED|05F8|05F9|\
05FD|05FE|05FF|0600|0601|0602|0603|0604|0605|0606|\
0607|0608|0609|060A|060B|060C|060D|060F|0610|0611|\
0612|0613|0614|0615|0617|0618|0619|061A|061B|061C|\
061D|061E|061F|0621|0622|0623|0625|0626|0627|0628|\
062A|062B|062C|062D|062E|0630|0631|0632|0635|0637|\
0638|063A|0640|0641|0643|0644|0645|0646|0647|0648|\
0649|064A|064B|064C|0651|0652|0653|0654|0655|0656|\
0658|0659|065A|065B|065C|06E0|06E1|06E2|06E3|06E4|\
06E5|06E6|06E7|06E8|06E9|06EA|06EB|06EC|06EF|06F1|\
06F8|06F9|06FA|06FB|06FD|06FF|0840|0844|0845|0846|\
0847|0848|0849|084A|084B|084C|084D|084F|0860|0861|\
0862|0863|0864|0865|0866|0867|0868|0869|086A|086C|\
086D|086E|086F|0870|0871|0872|0873|0874|0876|087A|\
087D|087E|087F|08A0|08A2|08A3|08A4|08A5|0A20|0A22|\
0A23|0A26|0A27|0A28|0A29|0A2A|0A2B|0A2C|0A2D|0A32|\
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='' ;;
esac
if [ -x /usr/sbin/update-alternatives-set-nvidia$ALT_SUFFIX ]; then
/usr/sbin/update-alternatives-set-nvidia$ALT_SUFFIX
elif [ -x /usr/sbin/update-alternatives-set-dri ]; then
/usr/sbin/update-alternatives-set-dri
else
exit 1
case $ALT_SUFFIX in
340) REC_DRIVER='xorg-drv-video-nvidia_340' ;;
304) REC_DRIVER='xorg-drv-video-nvidia_304' ;;
173|96|71) REC_DRIVER='nouveau' ;;
*) REC_DRIVER='xorg-drv-video-nvidia' ;;
esac
echo "NVIDIA recommended driver is $REC_DRIVER"
if [ "$DO_INSTALL" = "1" ]; then
rpm -q $REC_DRIVER || pkcon install $REC_DRIVER
fi
exit 0

View File

@ -1,14 +1,14 @@
# add new detected non-removable disk partitions to /etc/fstab at boot time
# (yes/no, default: yes)
FS_PARTS_UPDATE=yes
FS_PARTS_UPDATE=no
# configure detected partitions for automatic mounting on boot
# (yes/no, default: yes)
FS_PARTS_MOUNT=yes
FS_PARTS_MOUNT=no
# dynamically add detected swap partitions to /etc/fstab at boot time
# (yes/no, default: yes)
FS_SWAP_UPDATE=yes
FS_SWAP_UPDATE=no
# dinamically update the entries for /proc, /sys, devpts, tmpfs, usbfs
# (yes/no, default: yes)
@ -24,27 +24,42 @@ FS_CDROM_UPDATE=no
# remove entries from /etc/fstab for non-existing devices
# (yes/no, default: yes)
FS_NO_DEV_REMOVE=yes
FS_NO_DEV_REMOVE=no
# run configuration wizard if a new network device is discovered
# (dialog/auto/off, default: off)
NETWORK_NEWDEVICE=off
# network parameters for CDC ethernet interface
# (default: enabled)
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
# (on/off, default: on)
XORG_ENABLE_DRI=on
# network parameters for Android rndis ethernet interface
# (default: enabled)
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)
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
# (on/off, default: on)
XORG_DETECT_SCREEN_SIZE=on
# kdm: enable Xgl server
# (on/off, default: off)
KDM_ENABLE_XGL=off
# xorg server: power profile for Radeon driver
# (auto/low/mid/high, default: mid)
#XORG_POWER_PROFILE=mid
# force sound card reconfiguration
# (on/off, default: off)

View 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
View 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