commit b7ef6814a6ba20dbc08ed416a6de98a4aaf43870 Author: silvan Date: Wed Apr 27 19:57:03 2011 +0200 Initial commit diff --git a/BUGS b/BUGS new file mode 100644 index 0000000..d54da67 --- /dev/null +++ b/BUGS @@ -0,0 +1,2 @@ +- the scripts localtime and xorg should have a timeout +- the script filesystems should delete the unused directories found in /mnt diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..7a8bbac --- /dev/null +++ b/ChangeLog @@ -0,0 +1,972 @@ +Changes in version 1.2.3 20110319 +- sound: don't reprobe when no (PCI) soundcards are available +--------------------------------------------------------------------------------- + +Changes in version 1.2.2 20110314 +- initscript: check for plymouth existence before calling it +--------------------------------------------------------------------------------- + +Changes in version 1.2.1 20110301 +- postplug: handle first time marker file /var/lib/postplug/firsttime +- updates: don't run update scripts if first time execution +--------------------------------------------------------------------------------- + +Changes in version 1.2 20101106 +- updates: new script that manages one-shot execution of scripts that are in /etc/postplug/updates.d +--------------------------------------------------------------------------------- + +Changes in version 1.1.22 20101023 +- machine: create dbus machineid file if missing or empty +--------------------------------------------------------------------------------- + +Changes in version 1.1.21 20101005 +- xorg: force configure of nvidia driver disabling nouveau when nomodeset is passed to kernel command line +--------------------------------------------------------------------------------- + +Changes in version 1.1.20 20100917 +- xorg: configure keyboard with HAL when Xorg.conf is not generated (X.org automatic configuration) +--------------------------------------------------------------------------------- + +Changes in version 1.1.19 20100914 +- switch to use plymouth instead of fbsplash +--------------------------------------------------------------------------------- + +Changes in version 1.1.18 20100826 +- video: + * removed plugin because proved to freeze with ATI Radeon HD 4500 + + Kernel 2.6.33 + Radeon KMS + Grub2 1.98 +--------------------------------------------------------------------------------- + +Changes in version 1.1.17 20100806 +- xorg: add detection for 'Panel Size ' string +--------------------------------------------------------------------------------- + +Changes in version 1.1.16 20100729 +- machine: refresh /etc/sysconfig/machine if a different machine is detected +--------------------------------------------------------------------------------- + +Changes in version 1.1.15 20100704 +- xorg: added a new match string for laptop panel detection +--------------------------------------------------------------------------------- + +Changes in version 1.1.14 20100627 +- xorg: remove synpatic touchpad configuration from /etc/X11/xorg.conf (now managed via HAL) +--------------------------------------------------------------------------------- + +Changes in version 1.1.13 20100626 +- xorg: use xinit to test Xorg replacing removed option -probeonly (singe xorg-server 1.7) +--------------------------------------------------------------------------------- + +Changes in version 1.1.12 20100526 +- initscript: added splash messages +--------------------------------------------------------------------------------- + +Changes in version 1.1.11 20100225 +- filesystem: fixed check expression to detect removable device to prevent fstab instertion +- filesystem: add UUID entries support to fstab removal code +--------------------------------------------------------------------------------- + +Changes in version 1.1.10 20100206 +- filesystem: check for unload_heads to detect internal non removable drivers and reenable + FS_PARTS_UPDATE by default +--------------------------------------------------------------------------------- + +Changes in version 1.1.9 20100129 +- network: use ifconfig and iwconfig to check for interfaces changes for wicd automatic reconfiguration +--------------------------------------------------------------------------------- + +Changes in version 1.1.8 20091128 +- sound: add conditional support for obsoleted /etc/modprobe.conf file +- filesystem: disable FS_PARTS_UPDATE by default to let it be managed by udev/HAL +- network: use /proc/net/dev for checking wicd interfaces, because /proc/net/wireless is less reliable +--------------------------------------------------------------------------------- + +Changes in version 1.1.7 20091029 +- xorg: move inittab configuration for login manager in dynamic section +- network: modify wicd configuration to re-detect interfaces when they have changed +- xorg: removed code for setting X server -dpi 100 option +--------------------------------------------------------------------------------- + +Changes in version 1.1.6 20090809 +- xorg: set EDID detected string for intel chipsets +--------------------------------------------------------------------------------- + +Changes in version 1.1.5 20090803 +- xorg: detect /etc/sysconfig/keyboard changes and rewrite hal configuration for keyboard +--------------------------------------------------------------------------------- + +Changes in version 1.1.4 20090727 +- filesystems: detect and add to fstab root filesystem with proper check options +- filesystems: detect and add to fstab other already mounted non-removable filesystems +--------------------------------------------------------------------------------- + +Changes in version 1.1.3 20090725 +- sound: fix modprobe file name in /etc/modprobe.d (add .conf extension) +--------------------------------------------------------------------------------- + +Changes in version 1.1.2 20090629 +- filesystems: remove also root entry if device is not present +- filesystems: fixed get_new_mp_name() check when giving dir2..dirn name +--------------------------------------------------------------------------------- + +Changes in version 1.1.1 20090624 +- filesystems: fixed errors in check for duplicated mount point +- processor: fixed a typo in Athlon k8temp module detection +--------------------------------------------------------------------------------- + +Changes in version 1.1.0 20090618 +- xorg, sound: make use of lspci to detect hardware changes and reconfigure if something + has changed +--------------------------------------------------------------------------------- + +Changes in version 1.0.30 20090528 +- filesystems: + * handle spaces in labels +--------------------------------------------------------------------------------- + +Changes in version 1.0.29 20090526 +- filesystems: + * use blkid to detect filesystems + * use partition UUID as device in fstab when available + * use partition LABEL as mountpont in fstab when available +--------------------------------------------------------------------------------- + +Changes in version 1.0.28 20090401 +- xorg: + * fix a script error causing setting HorizSync 30-49 to all configurations +--------------------------------------------------------------------------------- + +Changes in version 1.0.27 20090331 +- xorg: + * fglrx test: add support for replacing "radeon" driver with "fglrx" (wasn't in there before??) + * fglrx: leave the driver detect panel size if detected as 'LCD on internal LVDS' +--------------------------------------------------------------------------------- + +Changes in version 1.0.26 20090217 +- xorg: + * remove configuration for keyboard +--------------------------------------------------------------------------------- + +Changes in version 1.0.25 20090210 +- xorg: + * remove configuration for synaptics speed and acceleration, use 1.0.0 driver defaults +--------------------------------------------------------------------------------- + +Changes in version 1.0.24 20090209 +- xorg: + * add TapButton* in synaptics configuration to enable tapping with 1.0.0 driver +--------------------------------------------------------------------------------- + +Changes in version 1.0.23 20090207 +- xorg: + * create HAL configuration for keyboard as required by xorg-server >= 1.4 +--------------------------------------------------------------------------------- + +Changes in version 1.0.22 20090125 +- script nvidia-autoselect-driver + * update to support the new legacy driver 173xx +--------------------------------------------------------------------------------- + +Changes in version 1.0.21 20090125 +- sound + * raise to 90% default 'Master' control +--------------------------------------------------------------------------------- + +Changes in version 1.0.20 20090119 +- sound + * set default volume for 'Speaker' control + * remove uneffective db volume setting before percent setting (?) +--------------------------------------------------------------------------------- + +Changes in version 1.0.19 20090117 +- sound + * invert % setting and db setting to fix initial volumes with some hardware +--------------------------------------------------------------------------------- + +Changes in version 1.0.18 20090115 +- sound + * run udevadm settle after modprobe +--------------------------------------------------------------------------------- + +Changes in version 1.0.17 20090111 +- processor + * added new module for processor hardware monitor module detection +--------------------------------------------------------------------------------- + +Changes in version 1.0.16 20090110 +- machine + * only get the first line of dmidecode output to avoid error to apper in + /etc/sysconfig/machine variables +--------------------------------------------------------------------------------- + +Changes in version 1.0.15 20090107 +- xorg + * synaptics touchpad: set MinSpeed=0.02, MaxSpeed=0.16, AccelFactor=0.0020, RightEdge=4800 +--------------------------------------------------------------------------------- + +Changes in version 1.0.14 20081223 +- sound + * added workaround configuration for HP Compaq 6735s (set option=laptop) + * (re)load module before setting default mixer volumes +--------------------------------------------------------------------------------- + +Changes in version 1.0.13 20081212 +- xorg + * fix: detect and skip commented line ('#') in video driver regexp +--------------------------------------------------------------------------------- + +Changes in version 1.0.12 20081211 +- xorg + * tune synaptic touchpad for better usability + * set EnableTwoFingerMinZ to 90 for two fingers support + * fglrx test: add support for replacing "radeonhd" driver with "fglrx" +--------------------------------------------------------------------------------- + +Changes in version 1.0.11 20081205 +- xorg: + * configure two fingers scrolling for touchpads; disable edge scrolling +--------------------------------------------------------------------------------- + +Changes in version 1.0.10 +- sound: + * remove old realtime modules configuration from /etc/modprobe.conf +- xorg: + * add string to check for missing EDID with NVIDIA driver and set hsync range + (openmamba bug 0000036) +--------------------------------------------------------------------------------- + +Changes in version 1.0.9 +- xorg: + * set default horizsync when EDID is reported as invalid by nvidia drivers +--------------------------------------------------------------------------------- + +Changes in version 1.0.8 +- machine: + * add more fields in configuration file from dmidecode +--------------------------------------------------------------------------------- + +Changes in version 1.0.7 +- machine: + * add SYSTEM_PRODUCT_NAME detection using dmidecode + * drop HAL check for Apple systems + * put variables into brackets in /etc/sysconfig/machine +--------------------------------------------------------------------------------- + +Changes in version 1.0.6 +- machine: use dmidecode to detect manufacturer from BIOS +--------------------------------------------------------------------------------- + +Changes in version 1.0.5 +- xorg: set synaptic and alps touchpad as AlwaysCore in xorg.conf +--------------------------------------------------------------------------------- + +Changes in version 1.0.4 +- modem: added plugin that detects internal modems and creates /etc/sysconfig/modem +--------------------------------------------------------------------------------- + +Changes in version 1.0.3 +- machine: add plugin that detects system manufacturer and writes it to + /etc/sysconfig/machine (now supports Apple and Zepto) +- redistribute rcpostplug.d execution order numbers +--------------------------------------------------------------------------------- + +Changes in version 1.0.2 +- video: added module that creates monitor xorg section file in /var/lib/postplug +--------------------------------------------------------------------------------- + +Changes in version 1.0.1 +- removed printer module as everything is done by /etc/modprobe.conf.d/lp +--------------------------------------------------------------------------------- + +Changes in version 1.0 +- upgrade release to 1.0 +- cleanup: removed postplug.d/swap directory packaged by mistake in + previous release +--------------------------------------------------------------------------------- + +Changes in version 0.4.20 +- filesystem: + * fixed mount point creation; don't create if different than $rootmp (/mnt) +--------------------------------------------------------------------------------- + +Changes in version 0.4.19 +- filesystem: + * mount new added filesystems + * set option gid=32 (nopermfs) to FAT and NTFS mounts +--------------------------------------------------------------------------------- + +Changes in version 0.4.18 +- filesystem: + * configure partitions for automatic mount if FS_PARTS_MOUNT is set to 'yes' + * fix check for mount points in fstab in case tab chars are used +--------------------------------------------------------------------------------- + +Changes in version 0.4.17 +- filesystem: don't add removable devices to fstab +- filesystem: enable by default automatic filesystem detection in fstab + (should be a good thing now that removable devices are skipped) + TODO: use parted instead of fdisk to support GPT partitions +--------------------------------------------------------------------------------- + +Changes in version 0.4.16 +- xorg: fix a syntax error in EDID string matching check +--------------------------------------------------------------------------------- + +Changes in version 0.4.15 +- xorg: enable composite extensions in fglrx driver +--------------------------------------------------------------------------------- + +Changes in version 0.4.14 +- xorg: fix an EDID search string +--------------------------------------------------------------------------------- + +Changes in version 0.4.13 +- network: removed interface renaming and dependency from ifrename because + this network interface persistence is managed by udev +--------------------------------------------------------------------------------- + +Changes in version 0.4.12 +- xorg: add (another) failed EDID detection string for the nvidia driver +--------------------------------------------------------------------------------- + +Changes in version 0.4.11 +- filesystem: disable by default automatic filesystem detection in fstab +--------------------------------------------------------------------------------- + +Changes in version 0.4.10 +- network: create configuration file for wireless devices + (/etc/sysconfig/network-devices/ifconfig.wlan*) +--------------------------------------------------------------------------------- + +Changes in version 0.4.9 +- xorg: call sync before xorg configure and probe to avoid filesystem + corruption in case of system hang +--------------------------------------------------------------------------------- + +Changes in version 0.4.8 +- xorg: fixed options xorg.conf setting in Drivers section for nVidia cards +- added 'nvidia-autoselect-driver' script for automatic setting between the + three nvidia drivers using the update-alternatives-set-nvidia* scripts +- xorg: make use of nvidia-autoselect-driver for xorg probing and configuration +--------------------------------------------------------------------------------- + +Changes in version 0.4.7 +- xorg: disable nvidia logo dith the NoLogo option in xorg.conf +- xorg: use fglrx libGL with the avivo driver +--------------------------------------------------------------------------------- + +Changes in version 0.4.6 +- filesystems: fix generation of mount points for newly detected partitions +--------------------------------------------------------------------------------- + +Changes in version 0.4.5 +- xorg + - add support for panel size autodetection with nvidia driver +- sound + - set CARDID_DB as /var/lib/postplug/alsaconf.cards + - build CARDID_DB and exit when called with SOUND_BUILD_CARDID_DB_ONLY=1 + - fix creation of KCMARTSRC file when no sound cards are detected +--------------------------------------------------------------------------------- + +Changes in version 0.4.4 +- xorg + - add server options required by compiz for DRI and nvidia cards +--------------------------------------------------------------------------------- + +Changes in version 0.4.3 +- xorg + - enable Composite extension by default +--------------------------------------------------------------------------------- + +Changes in version 0.4.2 +- xorg + - use update-alternatives-set-dri for default cards +--------------------------------------------------------------------------------- + +Changes in version 0.4.1 +- xorg + - set DefaultColorDepth to 24 by default for any driver except vesa and vga + - add support for lowres variable: set 1024x768 as max resolution + - and support for autores variable: let xorg detect the best resolution + - synaptic/alps touchpad: set alps protocol in auto-dev mode when neither + devices are detected +--------------------------------------------------------------------------------- + +Changes in version 0.4.0 +- xorg + - fglrx: add proprietary driver support when avivo driver is detected by + xorg-configure + - run 'telinit q' after changing inittab + - fglrx: removed configure workaround as xorg-server has been patched not + to probe this driver anymore + - postplug: added support for exporting variables passed from command line + so plugins can see them + - xorg: added support for freevideo passed as an argument of postplug= + in kernel command line; it currently only add free drivers support + for ATI cards +--------------------------------------------------------------------------------- + +Changes in version 0.3.37 +- xorg + - fglrx test: set standard alternatives before launching xorg -configure +--------------------------------------------------------------------------------- + +Changes in version 0.3.36 +- xorg + - dynamic section: add missing brackets to Device entries in Xorg.conf +--------------------------------------------------------------------------------- + +Changes in version 0.3.35 +- xorg + - don't modprobe fglrx +--------------------------------------------------------------------------------- + +Changes in version 0.3.34 +- filesystem + - fixed checking of extended partitions + - enable ntfs writing when /sbin/mount.ntfs-3g is found and `FS_PARTS_UPDATE' + is set to `on' +- sysconfig/postplug + - `FS_NTFS_ENABLE_WRITE' variable removed +--------------------------------------------------------------------------------- + +Changes in version 0.3.33 +- xorg + - add support for automatic alternatives configuration of dri, fglrx and + nvidia video drivers and libraries +--------------------------------------------------------------------------------- + +Changes in version 0.3.32 +- sysconfig/postplug + - set `NETWORK_NEWDEVICE' to auto by default + - set `FS_PARTS_UPDATE' to on by default +--------------------------------------------------------------------------------- + +Changes in version 0.3.31 +- filesystem + - code modified to support the new variable FS_NTFS_ENABLE_WRITE +- sysconfig/postplug + - new variable `FS_NTFS_ENABLE_WRITE' set to off by default +--------------------------------------------------------------------------------- + +Changes in version 0.3.30 +- xorg + - configure inittab for login_manager execution instead of kdm and + set /opt/kde3/bin/kdm as the default alternative if not set +--------------------------------------------------------------------------------- + +Changes in version 0.3.29 +- xorg + - fixed the check used when setting the `ServerCmd' variable in kdmrc +--------------------------------------------------------------------------------- + +Changes in version 0.3.28 +- xorg, sound + - do not get `KDEPREFIX' from `/etc/sysconfig/kdeconfig`, just set it looking + at all the possibile (supported) paths (currently `/usr' and `/opt/kde3`) +--------------------------------------------------------------------------------- + +Changes in version 0.3.27 +- xorg + - use the KDEPREFIX value provided by /etc/sysconfig/kdeconfig when possible + to speedup the system boot +- sound + - dynamically set the path of kcmartsrc using KDEPREFIX or the + 'kde-config --prefix' command + - create the sysconfig file `soundcards' with the list of the soundcard + detected + - do not check for soundcards if `SOUNDCARD0' is defined in the sysconfig file + `soundcards' unless `SOUND_FORCE_RESCAN' is set to on (boot speedup) + - sync with alsaconf version 1.0.13 + - do not modify `/etc/modprobe.conf', create `/etc/modprobe.conf.d/sound' +- sysconfig/postplug + - new variable `SOUND_FORCE_RESCAN' set to off by default +- Makefile + - removed unused variables +- log messages in a standard format (kernel-like) +- printers + - create `/etc/modprobe.conf.d/lp' instead of `/etc/modules.d/lp' if a kernel + 2.6 is detected +--------------------------------------------------------------------------------- + +Changes in version 0.3.26 +- xorg + - dynamically get the path for kdmrc using 'kde-config --prefix' command + - updated copyright +--------------------------------------------------------------------------------- + +Changes in version 0.3.25 +- xorg + - add kdmrc configuration support for Xgl +--------------------------------------------------------------------------------- + +Changes in version 0.3.24 +- xorg + - modify paths for Xorg 7.1 +--------------------------------------------------------------------------------- + +Changes in version 0.3.23 +- filesystem + - mount NTFS filesystems in ro mode for safety +--------------------------------------------------------------------------------- + +Changes in version 0.3.22 +- xorg + - checks for /usr/X11R6/lib/modules/drivers/fglrx_drv.so when detecting ATI + cards to avoid error messages during QiLinux installation +--------------------------------------------------------------------------------- + +Changes in version 0.3.21 +- printers: fixed loading of parallel port driver using /etc/modules.d/lp +--------------------------------------------------------------------------------- + +Changes in version 0.3.20 +- network: fixed wireless interface renaming to wlan* +- network: add support for ath* wireless interfaces (for Atheros based cards + with madwifi-ng driver) +--------------------------------------------------------------------------------- + +Changes in version 0.3.19 +- xorg: detect ATI cards by modprobing fglrx module +- xorg: set DefaultColorDepth for ATI cards +--------------------------------------------------------------------------------- + +Changes in version 0.3.18 +- xorg: remove USBMouse from Xorg configuration, it was a duplicate of PS2Mouse +--------------------------------------------------------------------------------- + +Changes in version 0.3.17 +- xorg: typo fix, load /etc/sysconfig/postplug +--------------------------------------------------------------------------------- + +Changes in version 0.3.16 +- sysconfig/postplug + - new variable for xorg module 'XORG_DETECT_SCREEN_SIZE' +- xorg: try to detect the screen size if 'PANEL_SIZE_DETECTED' is set to 'on' +--------------------------------------------------------------------------------- + +Changes in version 0.3.15 +- xorg: execute splash_text -refresh after Xorg probe +--------------------------------------------------------------------------------- + +Changes in version 0.3.14 +- sysconfig/postplug + - new variables for xorg module 'XORG_ENABLE_DRI', 'XORG_ENABLE_COMPOSITE_EXT' +- xorg + - enable DRI and composite extensions secontions according to the variables + 'XORG_ENABLE_DRI' (on by default) and 'XORG_ENABLE_COMPOSITE_EXT' + (off by default) +--------------------------------------------------------------------------------- + +Changes in version 0.3.13 +- xorg: don't enable composite extension for fglrx driver (or it disables + direct rendering) +--------------------------------------------------------------------------------- + +Changes in version 0.3.12 +- fix bootsplash progress bar and text display +- xorg + - add support for composite extensions + - some fixes on mice support + - remove resolution 400 option for mice +--------------------------------------------------------------------------------- + +Changes in version 0.3.11 +- xorg + - fix an error in referencing synaptic driver + - add other panel size detection strings +--------------------------------------------------------------------------------- + +Changes in version 0.3.10 +- xorg + - better support for mice in default configuration (including synaptics and + ALPS/2) + - use default video modes when panel size was detected +--------------------------------------------------------------------------------- + +Changes in version 0.3.9 +- sysconfig/postplug + - new variables FS_PARTS_UPDATE and FS_VFS_UPDATE + - FILESYSTEM_UPDATE variable removed + - new variables FS_FLOPPY_UPDATE and FS_CDROM_UPDATE +- filesystem + - code modified to support the new variables FS_PARTS_UPDATE, FS_VFS_UPDATE, + FS_FLOPPY_UPDATE and FS_CDROM_UPDATE + - use FHS 2.3 compliant mount points if FS_PARTS_UPDATE is enabled +- xorg + - fixes for ATI drivers + - run the test only if a new configuration has been created + +--------------------------------------------------------------------------------- + +Changes in version 0.3.8 +- sysconfig/postplug: FILESYSTEM_UPDATE disabled by default +- added xorg plugin + +--------------------------------------------------------------------------------- + +Changes in version 0.3.7 +- filesystem + - some code cleanups + - added code to perform devfs to udev device name conversion in /etc/fstab +- sysconfig/postplug: new variable `FILESYSTEM_SWAP_UPDATE' + +--------------------------------------------------------------------------------- + +Changes in version 0.3.6 +- sysconfig/postplug: FILESYSTEM_UPDATE and SUPERMOUNT disabled by default + in QiLinux 2.0 + +--------------------------------------------------------------------------------- + +Changes in version 0.3.5 +- loadconf: small fixes +--------------------------------------------------------------------------------- + +Changes in version 0.3.4 +- xorg: removed plugin (it is now in Xorg) and xorg-test script +- changed some translations +- scripts/defs: removed references to qilinux-release for livecd +--------------------------------------------------------------------------------- + +Changes in version 0.3.3 +- filesystem: fixed regexpr used to set `devdisk' if udev is used +- misc: loggin messages formatted in a more standard way +--------------------------------------------------------------------------------- + +Changes in version 0.3.2 +- sound: do not display an error message if `/usr/share/config/kcmartsrc' + cannot be created (ppc fix) +--------------------------------------------------------------------------------- + +Changes in version 0.3.1 +- xorg: execute Xorg -probeonly to check if DDC probe works or set default range +--------------------------------------------------------------------------------- + +Changes in version 0.3.0 +- postplug: conditionally execute postplug plugins via /proc/cmdline + examples: postplug=off : do not execute any plugins + postplug=noxorg,nosound : skip these two plugins +--------------------------------------------------------------------------------- + +Changes in version 0.2.35 +- xorg: change Xorg.conf behaviour according to qist-Xorgconfig and Xorg-test +--------------------------------------------------------------------------------- + +Changes in version 0.2.34 +- xorg: don't set resolution modes when creating xorg.conf file +--------------------------------------------------------------------------------- + +Changes in version 0.2.33 +- network: + - create $postplugnewdir/network always when an unconfigured adapter is + detected +--------------------------------------------------------------------------------- + +Changes in version 0.2.32 +- xorg: create $postplugnewdir/xorg always when new Xorg.conf is created +- add support for new splash_text with progress bar memory +- move postplug main executable to /sbin +--------------------------------------------------------------------------------- + +Changes in version 0.2.31 +- sysconfig: new variable `NETWORK_NEWDEVICE' +- defs: new variable `postplugnewdir' (/var/lib/postplug/new) +- network: + - several changes (code `NETWORK_NEWDEVICE'-related) + - save new detected device names on $postplugnewdir/network +- xorg: save new configurations on $postplugnewdir/xorg +--------------------------------------------------------------------------------- + +Changes in version 0.2.30 +- filesystem: + - added `FAT16<32M' in the list of supported FAT partitions +--------------------------------------------------------------------------------- + +Changes in version 0.2.29 +- filesystem: + - add linux any partitions with "defaults" option + - create /dev/shm if not existing (for udev) + - don't mount /dev/shm and devpts +--------------------------------------------------------------------------------- + +Changes in version 0.2.28 +- xorg: + - add support for 1280x800 and 1680x1050 wide screen resolutions +--------------------------------------------------------------------------------- + +Changes in version 0.2.27 +- filesystem: + - add support for /dev/ub* with udev +--------------------------------------------------------------------------------- +Changes in version 0.2.26 +- filesystem: + - initial udev support + - scan udev like devices and perform proper tests if udev is found +--------------------------------------------------------------------------------- + +Changes in version 0.2.25 +- filesystem: + - added "FAT12" in the list of supported FAT partitions + - also scan '/dev/ub/[a-z]/part[0-9]*' for devices + - do not add duplicate entries + - properly configure root partitions already mounted but not found in fstab +- sysconfig: new variable `FILESYSTEM_NO_DEV_REMOVE' +--------------------------------------------------------------------------------- + +Changes in version 0.2.24 +- filesystem: fixed test to detect partitions that will be removed from fstab +--------------------------------------------------------------------------------- + +Changes in version 0.2.23 +- filesystem: + - fixed cdrom numbering scheme to make it compatible with the algorithm used + by the qilinux installation program + - more verbose logging output +--------------------------------------------------------------------------------- + +Changes in version 0.2.22 +- localtime: syncronize hardware clock when creating /etc/localtime +--------------------------------------------------------------------------------- + +Changes in version 0.2.21 +- sound: reload modules snd-intel8x0 and snd-intel8x0m so they work on 1st boot +--------------------------------------------------------------------------------- + +Changes in version 0.2.20 +- sound: fix modprobe configuration for snd-intel8x0 and snd-intel8x0m +--------------------------------------------------------------------------------- + +Changes in version 0.2.19 +- xorg: add support for ATI fglrx proprietary drivers +--------------------------------------------------------------------------------- + +Changes in version 0.2.18 +- filesystem: + - revert FHS-2.3 /media directory related changes: too many side effects + - add the sync option when an USB device is detected + - fixed typo +- sound: + - create `/usr/share/config/kcmartsrc' if no sound devices are found +--------------------------------------------------------------------------------- + +Changes in version 0.2.17 +- xorg: set default screen geometry to 320 x 240 +--------------------------------------------------------------------------------- + +Changes in version 0.2.16 +- firewall: removed plugin (it must be run in iptables initscript) +--------------------------------------------------------------------------------- + +Changes in version 0.2.15 +- Makefile: delete `postplug.lang' before creating package tarball +- filesystem: support for /media/{floppy,cdrom,cdrecorder,zip} +- sysconfig: new variable: `FILESYSTEM_FHS_COMPLIANCE' +--------------------------------------------------------------------------------- + +Changes in version 0.2.14 +- filesystem: add an entry for tmpfs, if it doesn't exist +--------------------------------------------------------------------------------- + +Changes in version 0.2.13 +- xorg: set DefaultColorDepth 24 also for ati cards +--------------------------------------------------------------------------------- + +Changes in version 0.2.12 +- added firewall plugin for Guarddog configuration +- xorg: uncomment DisplaySize if present commented +- xorg: set DefaultColorDepth 24 for nvidia, radeon and fglrx cards +--------------------------------------------------------------------------------- + +Changes in version 0.2.11 +- xorg: set DisplaySize to a default value if not automatically set +--------------------------------------------------------------------------------- + +Changes in version 0.2.10 +- xorg: set DefaultColorDepth 24 for the "nvidia" driver +--------------------------------------------------------------------------------- + +Changes in version 0.2.9 +- xorg: don't set DefaultColorDepth in Xorg.conf +--------------------------------------------------------------------------------- + +Changes in version 0.2.8 +- network: added configuration support (rename to wlan*) for wireless interfaces +--------------------------------------------------------------------------------- + +Changes in version 0.2.7 +- filesystem: delete the entry for the sysfs if a 2.4.x kernel is detected +- filesystem: added support for supermount (cdrom only) +- added a sysconfig variable to enable/disable supermount +- added logrotate file for postplug +--------------------------------------------------------------------------------- + +Changes in version 0.2.6 +- xorg: mouse fixes for kernel 2.4.x +- xorg: code cleanups +--------------------------------------------------------------------------------- + +Changes in version 0.2.5 +- sound: fix check for pre-existing configuration on 2.6 kernel +- sound: load alsa modem intel8x0m with id=1 (so sound card has id=0) +--------------------------------------------------------------------------------- + +Changes in version 0.2.4 +- `alsasound' plugin renamed to `sound' +- cosmetic changes to standardize all the plugins +- printers: added logging message +--------------------------------------------------------------------------------- + +Changes in version 0.2.3 +- alsaconf: set sound system for realtime (modprobe realtime gid=11) +- printers: added script for configuring parport_pc module loading before lp +--------------------------------------------------------------------------------- + +Changes in version 0.2.2 +- set default localtime values on boot according to $LANG setting +--------------------------------------------------------------------------------- + +Changes in version 0.2.1 +- xorg: default xorg resolution set to 2048x1536 +--------------------------------------------------------------------------------- + +Changes in version 0.2.0 +- filesystems: + - partition type checking now works for partitions marked bootable +- new plugin: alsasound +--------------------------------------------------------------------------------- + +Changes in version 0.1.21 +- removed the definition (an creation) of `tempfile' in scrips/defs: it's not + used anymore and creates a void temporary file in /tmp at every boot +--------------------------------------------------------------------------------- + +Changes in version 0.1.20 +- filesystem: don't ls /dev/floppy/* to probe for devices +- xorg: fix for ImExPS/2 mouse +--------------------------------------------------------------------------------- + +Changes in version 0.1.19 +- xorg: added dynamic mouse setup and synaptics touchpad support +- localtime: removed timezone dialog +--------------------------------------------------------------------------------- + +Changes in version 0.1.18 +- remove xorg configuration dialog and add support for qist +--------------------------------------------------------------------------------- + +Changes in version 0.1.17 +- network plugin: + - fixed dialog window size + - fixed configuration of new interfaces +- localtime plugin: fixed warnings printed by find from findutils v.4.2.15 +- filesystems plugin: + - fixed the output of the function `get_new_mp_name' when a new device with + two or more partions has been discovered +--------------------------------------------------------------------------------- + +Changes in version 0.1.16 +- configure KDM to start with nice -15 +--------------------------------------------------------------------------------- + +Changes in version 0.1.15 +- new file `/etc/sysconfig/postplug' +- network plugin: + - revert changes made in version 0.1.14 (the code has been moved to the + QiLinux installation procedure) + - use fd#4 for dialog output (stderr may contain error messages) +- filesystems plugin: + - added support for samba fs + - do not delete the lines of `/etc/fstab' with unknown entries + - conditionally execution of the `filesystems' plugin according to the + settings found in `/etc/sysconfig/postplug' +- localtime plugin: + - use fd#4 for dialog output (stderr may contain error messages) +- xorg plugin + - use fd#4 for dialog output (stderr may contain error messages) +- Makefile updated ot install `/etc/sysconfig/postplug' +-------------------------------------------------------------------------------- + +Changes in version 0.1.14 +- network plugin: if a network interface has been configured with a static IP + use this ip in /etc/hosts instead of 127.0.0.1 +-------------------------------------------------------------------------------- + +Changes in version 0.1.13 +- added the subpackage `qilive', a postplug addon for QiLinux Live distros. +- execute `dialog --clear' only if dialog windows have been opened +-------------------------------------------------------------------------------- + +Changes in version 0.1.12 +- filesystems plugin: added support for more FAT16/FAT32 partitions (0b,0e) +- do not remove lines about network filesystems (SMB/NFS) found in /etc/fstab +-------------------------------------------------------------------------------- + +Changes in version 0.1.11 +- changed timeout for dialog windows from 20 to 60 seconds +- network plugin: + - use `/proc/net/dev' instead of `ifconfig -s' to get the list of the + ethernet interfaces + - write gateway ip and interface name to `/etc/sysconfig/network' + - remove temporary files when exit + - dialog timeout disabled for QiLinux Live CDs +-------------------------------------------------------------------------------- + +Changes in version 0.1.10 +- fixed xorg plugin: don't add "resolution" "400" option if already present +-------------------------------------------------------------------------------- + +Changes in version 0.1.9 +- network plugin: using "ifconfig -s" instead of "lspci" to find for ethernet + interfaces +-------------------------------------------------------------------------------- + +Changes in version 0.1.8 +- network plugin: removed modprobe of sk98lin driver +- filesystems plugin: removed modprobing of kernel device drivers +- xorg plugin: set mouse resolution according to kernel release requirements + (patch by Silvan Calarco ) +-------------------------------------------------------------------------------- + +Changes in version 0.1.7 +- network plugin: + - added italian translation + - added a timeout in the main configuration window + - added code to temporary disable the bootsplash screen + - added support for more than one ethernet network +- filesystems plugin: + - if the devpts line is added, mount devpts + - don't add a lines for sysfs every time the script is run +-------------------------------------------------------------------------------- + +Changes in version 0.1.6 +- filesystems plugin: + - when removing an entry in /etc/fstab, delete the directory used as a + mountpoint, if possible + - added support for DVD devices + - don't add in /etc/fstab the entries of CD-ROMs already mounted + - execute 'swapon -a' if a swap partition has been added +- Makefile now creates in /etc/postplug/rcpostplug.d/ the links to the + postplug plugins needed by postplug to execute them in the right order +- added 'network' plugin (partial support only: see FIXMEs in the code) +-------------------------------------------------------------------------------- + +Changes in version 0.1.5 +- xorg plugin: don't try to add the 'Section "DRI"' if /etc/X11/xorg.conf + doesn't exists +-------------------------------------------------------------------------------- + +Changes in version 0.1.4 +- the xorg plugin add + Section "DRI" + Mode 0666 + EndSection + if not found in the xorg/XFree configuration file +- added a ChangeLog file and some code in the Makefile to check if the + ChangeLog is updated when a new version of initscripts is released +- fixed xorg plugin errors when executed by user +-------------------------------------------------------------------------------- + +Changes in version 0.1.3 +- added the filesystems plugin +-------------------------------------------------------------------------------- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6eeb5f8 --- /dev/null +++ b/Makefile @@ -0,0 +1,147 @@ +# Makefile for postplug +# Copyright (C) 2004-2005 by Silvan Calarco +# Copyright (C) 2004-2007 by Davide Madrisan + +include VERSION + +PACKAGE = postplug + +prefix = /usr +exec_prefix = $(prefix) +sysconfdir = /etc +bindir = $(exec_prefix)/bin +sbindir = $(exec_prefix)/sbin +sbin = /sbin +mandir = $(prefix)/share/man +datadir = $(prefix)/share +initrddir = $(sysconfdir)/rc.d/init.d +logrotatedir = $(sysconfdir)/logrotate.d/ +sysconfigdir= $(sysconfdir)/sysconfig +localesdir = $(datadir)/locale + +srcdir = . + +DESTDIR = +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} -m 755 +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_DIR = ${INSTALL} -d -m 755 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +# package related variables +distdir = $(PACKAGE)-$(VERSION) +dist_archive = $(distdir).tar.bz2 + +postplugdir = ${sysconfdir}/$(PACKAGE)/postplug.d +postplugrcdir = $(sysconfdir)/$(PACKAGE)/rcpostplug.d +postplugupdatesdir = ${sysconfdir}/$(PACKAGE)/updates.d +postplugdefsdir = $(sysconfdir)/$(PACKAGE) +postplugnewdir = /var/lib/$(PACKAGE)/new + +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/*) + +.SUFFIXES: +.SUFFIXES: .po .mo +.po.mo:; msgfmt $< -o $@ + +all: locales + +locales: $(pck_catalogs:.po=.mo) + +install-locales: locales + @for f in $(pck_catalogs); do\ + lang=`echo $$f | sed 's,.*/\(.*\)\.po,\1,'`;\ + echo "installing i18n file for language \`$$lang'...";\ + dir="$(DESTDIR)$(localesdir)/$$lang/LC_MESSAGES";\ + $(INSTALL_DIR) $$dir;\ + $(INSTALL_DATA) $${f/.po/.mo} $$dir/$(PACKAGE).mo;\ + done + +install-defs: $(pck_defs) + @echo "installing defs file...";\ + $(INSTALL_DIR) $(DESTDIR)$(postplugdefsdir) + $(INSTALL_DATA) $^ $(DESTDIR)$(postplugdefsdir)/$(PACKAGE).defs + +install-initscript: $(pck_initscript) + @echo "installing initscript...";\ + $(INSTALL_DIR) $(DESTDIR)$(initrddir) + $(INSTALL_SCRIPT) $^ $(DESTDIR)$(initrddir)/$(PACKAGE) + +install-logrotate: $(pck_logrotate) + @echo "installing logrotate file...";\ + $(INSTALL_DIR) $(DESTDIR)$(logrotatedir) + $(INSTALL_DATA) $^ $(DESTDIR)$(logrotatedir)/$(PACKAGE) + +install-plugins: $(pck_plugins) + @echo "installing plugins..." + @$(INSTALL_DIR) $(DESTDIR)$(postplugdir) + @$(INSTALL_DIR) $(DESTDIR)$(postplugrcdir) + @$(INSTALL_DIR) $(DESTDIR)$(postplugupdatesdir) + for plugin in $(notdir $^); do\ + $(INSTALL_SCRIPT) postplug.d/$$plugin \ + $(DESTDIR)$(postplugdir)/$${plugin##[0-9][0-9]};\ + ln -sf $(postplugdir)/$${plugin##[0-9][0-9]}\ + $(DESTDIR)$(postplugrcdir)/$$plugin;\ + done + +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-programs: install-plugins install-scripts install-defs + @echo "installing $(PACKAGE)..." + @$(INSTALL_DIR) $(DESTDIR)$(sbin) + $(INSTALL_SCRIPT) $(pck_postplug) $(DESTDIR)$(sbin)/$(PACKAGE) + $(INSTALL_DIR) $(DESTDIR)$(postplugnewdir) + +install: \ + install-programs \ + install-initscript \ + install-logrotate \ + install-locales \ + install-sysconfig + +uninstall: + rm -f $(DESTDIR)$(sbin)/$(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)$(localesdir)/*/LC_MESSAGES/$(PACKAGE).mo + +dist: clean + @case `sed 15q ChangeLog` in \ + *"$(VERSION)"*) : ;; \ + *) \ + echo "ChangeLog not updated; not releasing" 1>&2;\ + exit 1;; \ + esac + @rm -f $(dist_archive);\ + tar cf - --exclude=$(PACKAGE)*.bz2 -C .. $(distdir) |\ + bzip2 -9 -c > $(dist_archive) + @echo "file \`$(dist_archive)' created" + +dist-rpm: dist + @rpm_sourcedir=`rpm --eval=%{_sourcedir}`;\ + mv -f $(dist_archive) $$rpm_sourcedir && \ + echo "and saved as \`$$rpm_sourcedir/$(dist_archive)'" + +clean: + rm -f $(dist_archive) + rm -f $(pck_catalogs:.po=.mo) + rm -f $(PACKAGE).lang diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..c075dc8 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +VERSION = 1.2.3 diff --git a/oldscripts/10localtime b/oldscripts/10localtime new file mode 100755 index 0000000..35cfff0 --- /dev/null +++ b/oldscripts/10localtime @@ -0,0 +1,97 @@ +#!/bin/bash +# localtime - localtime plugin for postplug +# Copyright (c) 2004-2005 by Silvan Calarco +# Copyright (c) 2004-2007 by Davide Madrisan + +[ -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 diff --git a/oldscripts/25video b/oldscripts/25video new file mode 100644 index 0000000..28fbdca --- /dev/null +++ b/oldscripts/25video @@ -0,0 +1,11 @@ +#!/bin/bash +# video - video configuration plugin for postplug +# Copyright (c) 2008 by Silvan Calarco +# +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 diff --git a/po/it.po b/po/it.po new file mode 100644 index 0000000..fc4c82a --- /dev/null +++ b/po/it.po @@ -0,0 +1,87 @@ +# Italian messages for postplug +# Copyright (C) 2004 Silvan Calarco +# This file is distributed under the same license as the QiLinux distribution. + +#: postplug + +# +# localtime plugin +# +msgid "Use the \\Z1UP\\Zn/\\Z1DOWN\\Zn arrow keys to scroll through the whole list of choices." +msgstr "Utilizza i tasti \\Z1UP\\Zn/\\Z1DOWN\\Zn per percorrere la lista delle scelte disponibili." +msgid " TIME ZONE SELECTION " +msgstr " IMPOSTAZIONE DEL FUSO ORARIO " +msgid "Please select the local time zone for this system." +msgstr "Scegliere il fuso orario locale per questo sistema." +msgid "browse" +msgstr "elenca" +msgid "Time zone selection" +msgstr "Impostazione del fuso orario" +msgid "Configuring system hardware..." +msgstr "Configurazione delle periferiche..." + +# +# network plugin +# +msgid "Network devices configuration" +msgstr "Configurazione interfacce di rete" +msgid " LAN INTERFACE CONFIGURATION " +msgstr " CONFIGURAZIONE INTERFACCIA LAN " +msgid "Automatically configure (DHCP) the \\Z4$2\\Zn interface?" +msgstr "Configurare in modo automatico (DHCP) l'interfaccia \\Z4$2\\Zn?" +msgid "Network interface configuration" +msgstr "Configurazione interfaccia di rete" +msgid "Please enter configuration for network interface" +msgstr "Inserisci i parametri relativi all'interfaccia di rete" +msgid "IP address:" +msgstr "Indirizzo IP:" +msgid "Netmask:" +msgstr "Maschera di rete:" +msgid " DEFAULT GATEWAY / DNS ADDRESSES / DOMAIN " +msgstr " DEFAULT GATEWAY / CONFIGURAZIONE DNS / DOMINIO " +msgid "Please enter the IP addresses of the \\Z1default gateway\\Zn, \\Z1primary DNS server\\Zn and \\Z1secondary DNS server\\Zn (optional) and the domain name." +msgstr "Inserisci gli indirizzi IP del \\Z1gateway di default\\Zn, del \\Z1DNS primario\\Zn e del \\Z1DNS secondario\\Zn (opzionale) ed il nome del dominio." +msgid "Default gateway:" +msgstr "Default gateway:" +msgid "Primary DNS:" +msgstr "DNS primario:" +msgid "Secondary DNS:" +msgstr "DNS secondario:" +msgid "Domain:" +msgstr "Dominio:" +msgid "Found ${#eth_ints[*]} LAN interface(s) not configured." +msgstr "Rilevate ${#eth_ints[*]} interfacce LAN non configurate." +msgid "Do you want to start the configuration wizard?" +msgstr "Eseguire la procedura di configurazione?" + +# +# xorg plugin +# +msgid "X.org graphical server configuration" +msgstr "Configurazione del server grafico X.org" +msgid " GRAPHICAL SERVER CONFIGURATION " +msgstr " CONFIGURAZIONE DEL SERVER GRAFICO " +msgid "Video modes (the highest will be the default mode):" +msgstr "Modi video (il più alto sarà il predefinito):" +msgid "Color Depth: " +msgstr "Profondità di colore: " +msgid "WARNING: if you exit here, graphical server might not work." +msgstr "AVVISO: annullando l'operazione il server grafico potrebbe non funzionare." +msgid "Do you want to exit anyway?" +msgstr "Si vuole uscire comunque?" +msgid "This is an X server test message." +msgstr "Questo è un messaggio di test del server grafico." +msgid "If you can clearly read this then the X server supports this video mode." +msgstr "Se si riesce a leggere con chiarezza questo testo significa che questo modo video è supportato." +msgid "Ok to keep these settings?" +msgstr "Mantenere queste impostazioni?" +msgid "Back" +msgstr "Indietro" + +# +# initscript +# +msgid "Configuring system..." +msgstr "Configurazione del sistema..." +msgid "Configuring system...done" +msgstr "Configurazione del sistema...completata" diff --git a/postplug.d/05machine b/postplug.d/05machine new file mode 100644 index 0000000..250b9fe --- /dev/null +++ b/postplug.d/05machine @@ -0,0 +1,36 @@ +#!/bin/bash +# +# machine - detects specific hardware platforms (mostly notebooks) +# +# Copyright (c) 2008-2010 by Silvan Calarco +# + +[ -e /etc/sysconfig/machine ] && . /etc/sysconfig/machine + +function getdmivar() { + local dmivalue + [ $1 ] || return 0 + + dmivalue=`/usr/sbin/dmidecode -s $1 2>/dev/null | head -n1` + echo $dmivalue + return 0 +} + +[ -e /var/lib/dbus/machine-id ] && DBUS_ID=`cat /var/lib/dbus/machine-id` + +[ "$DBUS_ID" ] || dbus-uuidgen > /var/lib/dbus/machine-id + +[ "$SYSTEM_MANUFACTURER" = "`getdmivar system-manufacturer`" -a \ + "$SYSTEM_PRODUCT_NAME" = "`getdmivar system-product-name`" -a \ + "$BIOS_VENDOR" = "`getdmivar bios-vendor`" ] && exit 0 + +cat > /etc/sysconfig/machine << _EOF +BIOS_VENDOR="`getdmivar bios-vendor`" +BIOS_VERSION="`getdmivar bios-version`" +BIOS_RELEASE_DATE="`getdmivar bios-release-date`" +SYSTEM_MANUFACTURER="`getdmivar system-manufacturer`" +SYSTEM_PRODUCT_NAME="`getdmivar system-product-name`" +SYSTEM_VERSION="`getdmivar system-version`" +SYSTEM_SERIAL_NUMBER="`getdmivar system-serial-number`" +SYSTEM_UUID="`getdmivar system-serial-uuid`" +_EOF diff --git a/postplug.d/07processor b/postplug.d/07processor new file mode 100644 index 0000000..8688a60 --- /dev/null +++ b/postplug.d/07processor @@ -0,0 +1,36 @@ +#!/bin/bash +# +# processor configuration plugin for postplug +# +# Copyright (c) 2008 by Silvan Calarco +# + +[ -e /etc/sysconfig/acpi ] && . /etc/sysconfig/acpi + +[ "$CPU_FREQ" = "" ] && { + + 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 + elif [ "`echo $CPUMODEL | grep Athlon`" ]; then + LOAD_MODULE=k8temp + elif [ "`echo $CPUMODEL | grep Thurion`" ]; then + LOAD_MODULE=k8temp + else + LOAD_MODULE=acpi_cpufreq + fi + + 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 + +} diff --git a/postplug.d/10filesystems b/postplug.d/10filesystems new file mode 100644 index 0000000..16b5267 --- /dev/null +++ b/postplug.d/10filesystems @@ -0,0 +1,355 @@ +#!/bin/bash +# +# filesystems - filesystems plugin for postplug +# Copyright (c) 2004-2007 by Davide Madrisan +# Copyright (c) 2007 by Stefano Cotta Ramusino +# Copyright (c) 2009 by Silvan Calarco + +if [ $UID != 0 ]; then + echo "$0: must be superuser." >&2 + exit 1 +fi + +me="filesystems" +rootmp="/mnt" + +. /etc/postplug/postplug.defs + +[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug + +fstab="/etc/fstab" + +# list of known devices to be scanned +# note: the '/dev/floppy/[0-9]' and '/dev/ub[a-z][0-9]*' entries +# has been removed +devs2scan='/dev/disk/by-uuid/*' + +# function devfs2dev() +# convert devfs names to stardard names +# args: +# $1: the devfs name that need to be converted +function devfs2dev() { + local devlong="$1" + + # exit if devfs is not running + [ -e /dev/.devfsd ] || { echo -n "$devlong"; return; } + + [[ "$devlong" ]] || { echo -n ""; return; } + + # we want to skip symlinks like '/dev/ide/hd/c0b0t0u0p1' + LANG=C find /dev -maxdepth 1 -type l 2>/dev/null | \ + while read dev; do + [[ "$(readlink -f $dev 2>/dev/null)" = "$devlong" ]] && + { echo -n "${dev:-$devlong}"; return 0; } + done + [ $? -eq 0 ] && return + + echo -n "$devlong" +} + +# function get_new_mp_name() +# Find for a usable mount point in the form $rootmp/$1[0-9]* +# or the current mount point if the device `$2' is already mounted +# args: +# $1: mount point suffix (i.e. "cdrom", "floppy", ...) +# $2: the device name (optional) +function get_new_mp_name() { + local mp_suffix="${1/ /%20}"; devfs="$2" + + if [ -n "$devfs" ]; then + # catch internal errors + [ -e $devfs ] || + { logmsg "$me" $"error: ""device not found ($devfs)" + exit 1; } + # take care of root partition already mounted + [ "`readlink -f /dev/root`" = "$devfs" ] && { + echo "/" + return + } + set -- $(mount | grep "^$(readlink -f $devfs)") + if [ "$3" != "" ]; then + echo "$3" + return + fi + fi + + # mountpoint FHS 2.3 compliant + case "$1" in cdrom|floppy) rootmp="/media" ;; esac + + for dir in $(find "$rootmp/${mp_suffix}" "$rootmp/${mp_suffix}"[0-9]* \ + -maxdepth 0 -type d -printf "%f " 2>/dev/null); do + # if `$dir' is not found in `$fstab' and + # no fs has been manually mounted on this dir... + [[ -z "$(grep "[[:space:]]$rootmp/$dir[[:space:]]" $fstab)" && + -z "$(mount | grep "[[:space:]]$rootmp/$dir[[:space:]]")" ]] && + { # ...we have found a good dir not yet used + echo "$rootmp/$dir"; return; } + done + # no directory available, so a new one must be created + case "$dir" in + "") echo ""$rootmp/${mp_suffix}"" ;; + $mp_suffix|$mp_suffix[0-9]*) + # note: ${mp_suffix} --> $rootmp/${mp_suffix} + echo "$rootmp/\ +${dir/[0-9]*/}$((${dir/$mp_suffix/}+1))" ;; + esac +} + + +tmpfstab=`mktemp -q -t $me.XXXXXXXX` || + { logmsg "$me" $"error: "$"cannot create temporary files" + exit 1; } + +trap "rm -f $tmpfstab" 0 1 2 5 15 + +# convert device paths from devfs to udev +if [ -e /dev/.devfsd ]; then + while read line; do + case "$line" in + /dev/*) + set -- $line + fs="$(devfs2dev "$1")" + echo "$fs ${line#* }" >> $tmpfstab + ;; + *) echo "$line" >> $tmpfstab ;; + esac + done < $fstab + mv $tmpfstab $fstab && chmod 644 $fstab + exit 0 +fi + +# note: remove some directories not FHS 2.3 compliant +#find /mnt/ -type d \( \ +# -name floppy -o -name floppy[0-9]\* -o \ +# -name cdrom -o -name cdrom[0-9]\* \ +# -name cdrecording -o -name cdrecording[0-9]\* \ +#\) -print | xargs rmdir 2>/dev/null + +[ -d /dev/.udev ] || exit 1 + +if [ "$FS_VFS_UPDATE" != no ]; then + # note: '[ \t]\+/proc[ \t]\+' does not work :( + grep -q "/proc" $fstab 2>/dev/null || + { echo "proc /proc proc defaults 0 0" >> $fstab + logmsg "$me" $"added an entry for \`proc' in $fstab" + mount /proc &>/dev/null; } + + grep -q "/sys" $fstab 2>/dev/null || + { echo "none /sys sysfs defaults 0 0" >> $fstab + logmsg "$me" $"added an entry for \`sys' in $fstab" + mount /sys &>/dev/null; } + + grep -q "/dev/pts" $fstab 2>/dev/null || + { echo "devpts /dev/pts devpts gid=4,mode=620 0 0" >> $fstab + logmsg "$me" $"added an entry for \`devpts' in $fstab" + mount /dev/pts &>/dev/null; } + + # make sure directory /dev/shm still exists + mkdir -p /dev/shm + + grep -q "/dev/shm" $fstab 2>/dev/null || + { echo "tmpfs /dev/shm tmpfs defaults 0 0" >> $fstab + logmsg "$me" $"added an entry for \`tmpfs' in $fstab" + mount /dev/shm &>/dev/null; } + + # probe for USB if the entry were not present in /etc/fstab + if [ -d /proc/bus/usb ]; then + grep -q "/proc/bus/usb" $fstab 2>/dev/null || + { echo "usbfs /proc/bus/usb usbfs defaults 0 0" >> $fstab + logmsg "$me" $"added an entry for \`usbfs' in $fstab" + mount /proc/bus/usb &>/dev/null; } + fi +fi + + +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 + /dev/*) + # remove entries and mount points for nonexistent devices + if [[ ! -e $fs ]]; then + sed -i "\@^$fs[ \t]*@d" $fstab 2>/dev/null + logmsg "$me" $"nonexistent entry removed (fs:$fs mp:$mount_point)" + rmdir $mount_point 2>/dev/null + continue + fi + [ ! -e $mount_point -a ${mount_point:0:${#rootmp}} = ${rootmp} ] && mkdir -p $mount_point + + ## if `/dev/root' exists use it instead of the real device name + #[[ "$mount_point" = "/" && -e /dev/root ]] && + # { unset devlink; fs="/dev/root"; } + ;; + UUID=*) + # remove entries and mount points for nonexistent devices + fs=`echo ${fs/UUID=/}` + if [[ ! -e /dev/disk/by-uuid/$fs ]]; then + sed -i "\@^UUID=$fs[ \t]*@d" $fstab 2>/dev/null + logmsg "$me" $"nonexistent entry removed (fs:$fs mp:$mount_point)" + rmdir $mount_point 2>/dev/null + continue + fi + [ ! -e $mount_point -a ${mount_point:0:${#rootmp}} = ${rootmp} ] && mkdir -p $mount_point + ;; + esac + done < $tmpfstab + > $tmpfstab +fi + +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 | while read line; do + + unset dev uuid devline devfstype TYPE UUID LABEL + dev=${line/:*} + devline=${line/*:} + eval $devline + label=$LABEL + devfstype=$TYPE + uuid=$UUID + [ "$label" ] || label="disk" + if [ -e $dev ]; then + # skip removable partitions + [ "`cat /sys/block/${dev:5:3}/removable 2>/dev/null`" = "1" \ + -a ! -e /sys/block/${dev:5:3}/device/unload_heads ] && { + [ "$DEBUG" ] && logmsg "$me" $"skipped device $dev ($uuid): removable" + continue; + } + # skip the current device if already in $fstab + grep -q "^[[:space:]]*$dev[[:space:]]\|^[[:space:]]*UUID=$uuid[[:space:]]" $fstab && + { [ "$DEBUG" ] && + logmsg "$me" $"skipped device $dev ($uuid): already in fstab" + continue; } + + [ "$DEBUG" ] && logmsg "$me" $"scanning for $dev ($uuid)..." + + # append the new device to $fstab + unset last_mp mount_point fstype options extra_options + check_options="0 0" + case $dev in + /dev/fd[0-9]*|/dev/floppy/[0-9]) # floppy disk drives + [ "$FS_FLOPPY_UPDATE" = yes ] || continue + mount_point=$(get_new_mp_name floppy) + ;; + /dev/cdrom[0-9]*) # CDROM devices + [ "$FS_CDROM_UPDATE" = yes ] || continue + # check if the CD is already mounted + devfs="$(readlink -f $dev)" + mount | \ + while read fstab_dev skip; do + echo "$(readlink -f $fstab_dev)" + done | grep -qi "$devfs" + # note: the CD is always mounted if automount is enabled + if [ $? -eq 0 ]; then + logmsg "$me" $"ignoring device \`$dev' (already mounted)" + continue + fi + mount_point=$(get_new_mp_name cdrom) + ;; + /dev/sd[a-z][0-9]*|\ + /dev/hd[a-z][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 + #case "$devlink" in + # /dev/ub/[a-z]*/part[0-9]*) extra_options=",sync" ;; + #esac + + # IDE, SCSI disks, CDRW, USB devices + devdisk="${dev/[0-9]*/}" + devline=$( blkid $dev 2>/dev/null | sed "s|.*:||") + eval $devline + devfstype=$TYPE +# devfstype=$( /sbin/fdisk -l $devdisk 2>/dev/null | \ +# sed -n "/^${dev//\//\\/}/{ +# s,\*,,; # remove the star (bootable partition) +# # select the 5th column (fs id) +# s/\([^ ]*[ ]*\)\{4\}\([^ ]*\).*/\2/p}" ) + case $devfstype in + linux-swap|swap) # Linux swap + [ "$FS_SWAP_UPDATE" = yes ] || continue + mount_point="swap " + fstype="swap" + options="pri=1" + let "swapon = 1" ;; + ext*|reiserfs|reiser4) # Linux partition + [ "$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! + check_options="1 1" + fstype="$(mount | \ + sed -n "/ \/ /{s,.*type \([^ ]*\).*,\1,;p}")" + #[[ -e /dev/root ]] && + # { unset devlink; dev="/dev/root"; } + fi + options="defaults" ;; + ntfs|hpfs) # HPFS/NTFS + [ "$FS_PARTS_UPDATE" = yes ] || continue + mount_point=$(get_new_mp_name "$label" $dev) + if [ -x /sbin/mount.ntfs-3g ]; then + fstype="ntfs-3g" + options="${AUTO_ADD}user,gid=32,umask=002" + [ "$LANG" ] && options="$options,locale=$LANG" + else + options="${AUTO_ADD}user,ro,gid=32,umask=002" + fi ;; + fat12|fat16|fat32|FAT|vfat) + [ "$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 + mount_point=$(get_new_mp_name "$label" $dev) + options="${AUTO_ADD}user" ;; +# f) # W95 Ext'd (LBA) +# [ "$FS_PARTS_UPDATE" = yes ] || continue +# unset nblocks +# nblocks=$( echo $(grep ${dev/\/dev\//} /proc/partitions) | \ +# cut -d" " -f3 ) +# [ "$nblocks" = 1 ] && continue +# mount_point=$(get_new_mp_name "$label") +# options="${AUTO_ADD}user,gid=32,umask=002" ;; + *) # ignore unknown partitions + [ "$FS_PARTS_UPDATE" = yes ] || continue + logmsg "$me" $"ignoring unknown partition (id:$devfstype)" + continue ;; + esac + ;; + *) logmsg "$me" "FIXME: "$"unknown label for case ($dev)" + ;; + 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" + if [ "$uuid" ]; then + echo "# $dev \"$label\"" >> $fstab + echo "\ +UUID=${uuid} $mount_point \ +${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab + else + echo "\ +$dev $mount_point \ +${fstype:-"auto"} ${options:-"noauto,user"}${extra_options} ${check_options}" >> $fstab + fi + # create the mount point and mount the new device + [ "${mount_point:0:${#rootmp}}" = "${rootmp}" ] && { + mkdir -p "$mount_point" + mount "$mount_point" + } + fi + fi +done + +[ "$swapon" = 1 ] && swapon -a +exit 0 diff --git a/postplug.d/12loadconf b/postplug.d/12loadconf new file mode 100644 index 0000000..03a35e4 --- /dev/null +++ b/postplug.d/12loadconf @@ -0,0 +1,52 @@ +#!/bin/bash +# +# loadconf - postplug plugin: restore the QiLinux Live system/user configuration +# Copyright (c) 2004-2007 by Davide Madrisan + +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 diff --git a/postplug.d/15localtime b/postplug.d/15localtime new file mode 100644 index 0000000..c16d72e --- /dev/null +++ b/postplug.d/15localtime @@ -0,0 +1,35 @@ +#!/bin/bash +# localtime - localtime plugin for postplug +# Copyright (c) 2004-2005 by Silvan Calarco +# Copyright (c) 2004-2007 by Davide Madrisan + +if [ $UID != 0 ]; then + echo "$0: must be superuser." >&2 + exit 1 +fi + +[ -f /etc/localtime ] && exit 0 + +me="localtime" + +. /etc/postplug/postplug.defs + +LOCALTIMEFILE=/etc/localtime +ZONEINFODIR=/usr/share/zoneinfo + +logmsg "$me" $"creating /etc/timezone and /etc/localtime files..." + +# FIXME +case "$LANG" in +it_*) + echo "Europe/Rome" > /etc/timezone + cp -f $ZONEINFODIR/Europe/Rome /etc/localtime +;; +*) echo "GMT" > /etc/timezone + cp -f $ZONEINFODIR/GMT /etc/localtime +;; +esac + +[ -x /etc/init.d/setclock ] && service setclock start &>/dev/null + +exit 0 diff --git a/postplug.d/20network b/postplug.d/20network new file mode 100644 index 0000000..25ef804 --- /dev/null +++ b/postplug.d/20network @@ -0,0 +1,397 @@ +#!/bin/bash +# +# network - network plugin for postplug +# +# Copyright (c) 2004-2007 by Davide Madrisan +# Copyright (c) 2009 by Silvan Calarco +# + +if [ $UID != 0 ]; then + echo "$0: must be superuser." >&2 + exit 1 +fi + +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 +[ -r $rc_networkfunctions ] && . $rc_networkfunctions + +resolv_conf=/etc/resolv.conf +sysconf_network=/etc/sysconfig/network + +function wlan_config_auto() { + + local wlan_interface="$1" + + cat > $network_devices/ifconfig.${wlan_interface} << _EOF +IF=${wlan_interface} +BOOTPROTO=dhcp +ZONE=local +ONBOOT=yes +#WIRELESS_ESSID="" +#WIRELESS_MODE=managed +#WIRELESS_ENC=s:ENCRYPTIONKEY +#WIRELESS_NWID= +#WIRELESS_FREQ= +_EOF + +} + +function eth_config_auto() { + + local eth_interface="$1" + + cat > $network_devices/ifconfig.${eth_interface} << _EOF +IF=${eth_interface} +BOOTPROTO=dhcp +ZONE=local +ONBOOT=yes +_EOF + +} + + +# FIXME : add support for 'ZONE=$IF_ZONE' +function eth_config() { + # eth_config {--enable|--disable|--auto} + + TEMP=`LANG=C getopt -o eda --long enable,disable,auto -n "$FUNCNAME" -- "$@"` + [[ $? = 0 ]] || return 1 + + eval set -- "$TEMP" + + 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 + 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/ifconfig.${eth_interface} << _EOF +IF=${eth_interface} +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 + #unset IF_ZONE + cat > $network_devices/ifconfig.${eth_interface} << _EOF +IF=${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/ifconfig.${eth_interface} << _EOF +IF=${eth_interface} +ONBOOT=yes +ZONE=local +IPADDR=$IF_IPADDR +NETWORK=$IF_NETWORK +NETMASK=$IF_NETMASK +BROADCAST=$IF_BROADCAST +_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 ifconfig.* 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/ifconfig.$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/ifconfig.$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" + 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 + ;; + *) logmsg "$me" "error: "$"\ +illegal value for NETWORK_NEWDEVICE ($NETWORK_NEWDEVICE)" + exit 1 + ;; + esac +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/ifconfig.$eth_int ] || continue + unset BOOTPROTO + . $network_devices/ifconfig.$eth_int + [ "$BOOTPROTO" = "dhcp" ] && exit + done + + for wlan_int in ${wlan_ints[*]}; do + [ -r $network_devices/ifconfig.$wlan_int ] || continue + unset BOOTPROTO + . $network_devices/ifconfig.$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 + +if [ -e /etc/wicd/manager-settings.conf ]; then + eval `grep "wireless_interface" /etc/wicd/manager-settings.conf | tr -d ' '` + eval `grep "wired_interface" /etc/wicd/manager-settings.conf | tr -d ' '` + if [ "$wireless_interface" ]; then + test_iwconfig=`iwconfig $wireless_interface 2>/dev/null` + [ "$test_iwconfig" = "" ] && \ + sed -i "/wireless_interface =.*/d" /etc/wicd/manager-settings.conf + fi + if [ "$wired_interface" ]; then + test_iwconfig=`iwconfig $wired_interface 2>/dev/null` + test_ifconfig=`ifconfig $wired_interface 2>/dev/null` + [ "$test_ifconfig" = "" -o "$test_iwconfig" != "" ] && \ + sed -i "/wired_interface =.*/d" /etc/wicd/manager-settings.conf + fi +fi + +exit 0 diff --git a/postplug.d/30xorg b/postplug.d/30xorg new file mode 100644 index 0000000..d9808fb --- /dev/null +++ b/postplug.d/30xorg @@ -0,0 +1,470 @@ +#!/bin/bash +# xorg - xorg plugin for postplug +# Copyright (c) 2004-2009 by Silvan Calarco +# Copyright (c) 2004-2007 by Davide Madrisan + +if [ $UID != 0 ]; then + echo "$0: must be superuser." >&2 + exit 1 +fi + +[ -r /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard +[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug + +me="xorg" + +. /etc/postplug/postplug.defs + +XORGCONF=/etc/X11/xorg.conf + +# kde-config is possibly not called for boot time speed +[ -r /opt/kde/share/config/kdm/kdmrc ] && KDMRC=/opt/kde/share/config/kdm/kdmrc || { + [ -r /opt/kde3/share/config/kdm/kdmrc ] && KDMRC=/opt/kde3/share/config/kdm/kdmrc || \ + KDMRC="$(kde-config --prefix 2>/dev/null)/share/config/kdm/kdmrc" +} + +[ -w "$KDMRC" ] || + { logmsg "$me" "warning: cannot find kdmrc; KDM will not be configured" + unset KDMRC; } + +#postplugnew_file=$postplugnewdir/xorg +#rm -f $postplugnew_file + +[ -e /etc/X11/XF86Config -a ! -e /etc/X11/xorg.conf ] && + cp /etc/X11/XF86Config $XORGCONF + +kernel_min=$(uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,') + +# xorg_section_screen_config() +# write a new xorg configuration +# args: +# $1 : default color depth +# $2 : file with the video modes (one per line) +function xorg_section_screen_config() { + # fixme: this deletes from first subsection "Display" to the endsection + sed '/SubSection "Display"/,/EndSection/s/.*//p' $XORGCONF | \ + grep -v "^\s*$" > $XORGCONF.new + + for i in `seq 1 ${#COLORDEPTHS[@]}`; do + echo -n "\ + SubSection \"Display\" + Modes " >> $XORGCONF.new + grep "${COLORDEPTHS[$i-1]} bpp" $2 | tac | \ + while read mode skip; do + echo -n "\"${mode%,*}\" " >> $XORGCONF.new + done + echo " + Depth ${COLORDEPTHS[$i-1]} + EndSubSection" >> $XORGCONF.new + done + echo "EndSection" >> $XORGCONF.new + + mv $XORGCONF $XORGCONF.save + 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/kde3/bin/kdm 20 + + telinit q + } +} + +function xorg_hal_configure_keyboard() { + # Keyboard configuration (Xorg >= 1.4 uses HAL) + [ ! -e /etc/hal/fdi/policy/10-keymap.fdi -o \ + /etc/sysconfing/keyboard -nt /etc/hal/fdi/policy/10-keymap.fdi ] && { + + if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then + case "${LANG:0:2}" in + it) + XKB_MODEL="pc105" + XKB_LAYOUT="it" ;; + de) + XKB_MODEL="pc105" + XKB_LAYOUT="de" ;; + es) + XKB_MODEL="pc105" + XKB_LAYOUT="es" ;; + fr) + XKB_MODEL="pc105" + XKB_LAYOUT="fr" ;; + *) + XKB_MODEL="pc104" + XKB_LAYOUT="us" ;; + esac + fi + + cat > /etc/hal/fdi/policy/10-keymap.fdi << __EOF + + + $XKB_LAYOUT + $XKB_MODEL + base + +__EOF + + } +} + +# (re)create the '/tmp/.ICE-unix' directory with the right permissions +rm -fr /tmp/.ICE-unix +install -m 1777 -o root -g root -d /tmp/.ICE-unix + +# video detection +VIDEO_DEV="`lspci -n | grep " 03[0-9][0-9]: "`" + +if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then + VIDEO_DEV_CACHED="`cat $postpluglibdir/xorg.cache`" + [ "$VIDEO_DEV" = "$VIDEO_DEV_CACHED" ] || { + logmsg "$me" "warning: video device appears to have changed; re-probing" + mv $XORGCONF $XORGCONF.postplug.save + } +fi + +if [ ! -e $XORGCONF ]; then +# +# Create a new Xorg configuration file +# + + # 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 + + HOME=/tmp Xorg :5 -configure 2>>$logfile || { + logmsg "$me" "warning: xorg autoprobed configuration failed; enabling experimental xorg autoconfig" + xorg_configure_loginmanager + xorg_hal_configure_keyboard + exit 1 + } + + mv /tmp/xorg.conf.new $XORGCONF + let "CONFCREATED = 1" + + sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF +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 + + [ "`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 + echo "blacklist nouveau" > /etc/modprobe.d/postplug-nouveau.conf + 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 ;; + *) sed -i -e '/Section "Screen"/a\ + DefaultColorDepth 24' $XORGCONF ;; + esac + + # Compiz/3d configuration options + if [ "$VIDEODRIVER" != "nvidia" ]; then + sed -i -e '/Section "Device"/a\ + Option "XAANoOffscreenPixmaps" "true"' $XORGCONF + elif [ "$VIDEODRIVER" == "nvidia" ]; then + sed -i -e '/Section "Screen"/a\ + Option "AddARGBGLXVisuals" "true"\ + Option "DisableGLXRootClipping" "true"' $XORGCONF + fi + + # Configure fonts + sed -i '/fonts\/Type1/d;s@\(.*X11/fonts.*\)/@\1:unscaled@' $XORGCONF + fc-cache + + # Configure keyboard + + # NOTE: + # see: /etc/X11/xkb/README.config + # /usr/lib/X11/doc/README.XKB-Config + # The X Keyboard Extension: Protocol Specification + # + # xkb configuration + # + # + # /etc/X11/xkb/rules/xfree86.lst (commonest file of rules) + # + # The parameters are: + # XkbRules - files of rules to be used for keyboard mapping composition + # XkbModel - name of model of your keyboard type + # XkbLayout - layout(s) you intend to use + # XkbVariant - variant(s) of layout you intend to use + # XkbOptions - extra xkb configuration options + # + # XkbVariant has been left out: that means the default variant named basic is loaded. + + if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then + case "${LANG:0:2}" in + it) + XKB_MODEL="pc105" + XKB_LAYOUT="it" ;; + de) + XKB_MODEL="pc105" + XKB_LAYOUT="de" ;; + es) + XKB_MODEL="pc105" + XKB_LAYOUT="es" ;; + fr) + XKB_MODEL="pc105" + XKB_LAYOUT="fr" ;; + *) + XKB_MODEL="pc104" + XKB_LAYOUT="us" ;; + esac + fi + + if [ -n "XKbOptions" ]; then + sed -i -e "/Identifier\W*\"Keyboard.*\"/a\\ + Option \"XkbModel\" \"$XKB_MODEL\"\\ + Option \"XkbLayout\" \"$XKB_LAYOUT\"\\ + Option \"XKbOptions\" \"$XKB_OPTIONS\"" $XORGCONF + else + sed -i -e "/Identifier\W*\"Keyboard.*\"/a\\ + Option \"XkbModel\" \"$XKB_MODEL\"\\ + Option \"XkbLayout\" \"$XKB_LAYOUT\"" $XORGCONF + fi + + # global mouse modifications to default configuration + sed -i -e '/"CorePointer"/i \ + Option "AllowMouseOpenFail"' $XORGCONF + +# 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 + + if [ -r /var/log/Xorg.5.log ]; then + + if [ "`grep 'hsync range of 28.00-33.00 kHz' /var/log/Xorg.5.log`" -o \ + "`grep 'The EDID read for display device CRT-0 is invalid' /var/log/Xorg.5.log`" ]; then + # no values could be autodetected by DDC, so use a failsafe low value (30-49) + HSYNC_RANGE_NOT_DETECTED="true" + fi + + [ "`grep 'Printing DDC gathered Modelines' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + [ "`grep 'EDID vendor \"' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + [ "`grep 'Adding EDID-provided mode' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + [ "`grep -i 'Panel size from' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + [ "`grep -i 'Panel size is' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + [ "`grep -i 'Panel Size ' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + [ "`grep 'VESA VBE DDC read successfully' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + [ "`grep 'LCD on internal LVDS' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + [ "`grep 'LCD on internal LVDS' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + [ "`grep 'LVDS.* using initial mode' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + + # nvidia driver: CRT-. EDID not got? + if [ "`grep 'Unable to read EDID for display device CRT-.' /var/log/Xorg.5.log`" -o \ + "`grep 'Unable to get display device CRT-..s EDID' /var/log/Xorg.5.log`" ]; then + # nvidia driver: disable CRT-x from being used by default if DFP-0 is present + [ "`grep 'DFP-0' /var/log/Xorg.5.log`" ] && { + sed -i -e '/Section "Screen"/a\ + Option "ConnectedMonitor" "DFP"' $XORGCONF + } || { + HSYNC_RANGE_NOT_DETECTED="true" + unset PANEL_SIZE_DETECTED + } + else + # nvidia driver: we trust in nvidia-auto-select + [ "`grep 'nvidia-auto-select' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + fi + + # fglrx driver + [ "`grep 'EDID Version:' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true" + + [ "$autoresvideo" ] && PANEL_SIZE_DETECTED="true" + + [ "$XORG_DETECT_SCREEN_SIZE" = off -o "$lowresvideo" ] && unset PANEL_SIZE_DETECTED + + [ "$HSYNC_RANGE_NOT_DETECTED" ] && { + logmsg "$me" "\ +warning: DDC hsync range cannot be detected, setting default of 30-49 kHz" + sed -i -e '/Section\W*"Monitor"/a\ + HorizSync 30-49' $XORGCONF + } + + [ "$PANEL_SIZE_DETECTED" ] || + sed -i -e '/SubSection "Display"/a\ + Modes "1024x768" "800x600" "640x480"' $XORGCONF + else + logmsg "$me" "warning: "$"Xorg probe failed!" + fi +fi + +#################################### +# +# Xorg dynamic configuration section +# +#################################### + +[ -e $XORGCONF ] || { + logmsg "$me" "error: "$"missing Xorg configuration file; aborting" + exit 1 +} + +# configure inittab for login manager +xorg_configure_loginmanager + +# 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) +sed -i "/[\W]*InputDevice[\W]*"USBMouse".*/d" $XORGCONF + +# remove obsolete input pointers configuration (since xorg-server 1.7) +sed -i "/[[:space:]]*InputDevice[[:space:]]*.*PS2Mouse.*/d; \ + /[[:space:]]*InputDevice[[:space:]]*.*Synaptics.*/d; \ + /[[:space:]]*InputDevice[[:space:]]*.*Alps.*/d" $XORGCONF + +# Remove all devices set +sed -i "/\W*Option \"Device\".*/d" $XORGCONF + +# Configure keyboard +xorg_hal_configure_keyboard + +# 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 diff --git a/postplug.d/35sound b/postplug.d/35sound new file mode 100644 index 0000000..672a15a --- /dev/null +++ b/postplug.d/35sound @@ -0,0 +1,405 @@ +#!/bin/bash +# +# sound - sound configuration plugin for postplug +# Copyright (c) 2005-2007 by Davide Madrisan +# Copyright (c) 2005-2009 by Silvan Calarco + +# Note: Some code has been stolen from /usr/sbin/alsaconf version 1.0.13 + +if [ $UID != 0 ]; then + echo "$0: must be superuser." >&2 + exit 1 +fi + +me="sound" + +[ -r /etc/sysconfig/machine ] && . /etc/sysconfig/machine + +. /etc/postplug/postplug.defs + +[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug + +# remove obsolete realtime module configuration +if [ -e /etc/modprobe.conf -a "`grep ' realtime ' /etc/modprobe.conf 2>/dev/null`" ]; then + sed -i "/options realtime */d" /etc/modprobe.conf + sed -i "/alias on-boot-realtime realtime/d" /etc/modprobe.conf +fi + +LSPCI=/usr/sbin/lspci +SYSCONFIG_SOUNDCARDS=/etc/sysconfig/soundcards +CARDID_DB=/var/lib/postplug/alsaconf.cards + +function build_card_db() { + # convert ISA PnP id number to string 'ABC' + function convert_isapnp_id() { + [ "$1" ] || return + local a b c strs + let a='('$1'>>2) & 0x3f' + let b='(('$1' & 0x03) << 3) | (('$1' >> 13) & 0x07)' + let c='('$1'>> 8) & 0x1f' + strs='@ABCDEFGHIJKLMNOPQRSTUVWXYZ' + echo ${strs:$a:1}${strs:$b:1}${strs:$c:1} + } + + # swap high & low bytes + function swap_number() { + local v + if [ -z "$1" ]; then + echo "0000" + return + fi + let v='(('$1'>>8)&0xff)|(('$1'&0xff)<<8)' + printf "%04x" $v + } + + local MODDIR=/lib/modules/`uname -r` + local last_driver driver vendor device dummy id1 id2 + echo -n > $1 + + # list pci cards + while read driver vendor device dummy; do + if expr $driver : 'snd-.*' >/dev/null ; then + if [ "$last_driver" != "$driver" ]; then + echo $driver.o + last_driver=$driver + fi + id1=`printf '0x%04x' $vendor` + id2=`printf '0x%04x' $device` + echo "PCI: $id1=$id2" + fi + done < $MODDIR/modules.pcimap >> $1 + + # list isapnp cards + local cardvendor carddevice data func dev1 dev2 + while read driver cardvendor carddevice data vendor func; do + if expr $driver : 'snd-.*' >/dev/null ; then + if [ "$last_driver" != "$driver" ]; then + echo $driver.o + last_driver=$driver + fi + id1=`convert_isapnp_id $cardvendor` + dev1=`swap_number $carddevice` + id2=`convert_isapnp_id $vendor` + dev2=`swap_number $func` + echo "ISAPNP: $id1$dev1=$id2$dev2" + fi + done < $MODDIR/modules.isapnpmap >> $1 +} + +function probe_cards() { + local use_modinfo_db=0 + local index bindex d1 d2 ncards + + [ -r /proc/isapnp ] || /sbin/modprobe isapnp >/dev/null 2>&1 + [ -r /proc/isapnp ] || /sbin/modprobe isa-pnp >/dev/null 2>&1 + if [ -r /proc/isapnp ]; then + cat /proc/isapnp > "$DUMP" + found="1" + elif [ -d /sys/bus/pnp/devices ]; then + # use 2.6 kernel's sysfs output + # fake the isapnp dump + index=0 + bindex=0 + for d1 in /sys/devices/pnp* ; do + for d2 in $d1/*:* ; do + if [ -r $d2/card_id ]; then + id=`cat $d2/card_id` + name=`cat $d2/name` + echo "Card $index '$id:$name' " >> "$DUMP" + index=$[$index+1] + found="1" + elif [ -r $d2/id ]; then + # FIXME: multiple id might be present (separated with new-line) + id=`head -n 1 $d2/id` + echo "BIOS $bindex '$id' " >> "$DUMP" + bindex=$[$bindex+1] + found="1" + fi + done + done + fi + if [ "$found" = "0" ]; then + echo -n >"$DUMP" + fi + + [ -r $CARDID_DB ] || use_modinfo_db=1 + + if [ $use_modinfo_db != 1 ]; then + [ $CARDID_DB -ot /lib/modules/`uname -r`/modules.dep ] && + use_modinfo_db=1 + fi + if [ $use_modinfo_db = 1 ]; then + logmsg "$me" "building soundcard database \`$CARDID_DB'" + build_card_db $CARDID_DB + fi + + if [ ! -r $CARDID_DB ]; then + logmsg "$me" "error: "$"cannot create soundcard database" + exit 1 + fi + + ncards=`grep '^snd-.*\.o$' $CARDID_DB | wc -w` + + awk ' +BEGIN { + format="%-40s %s\n"; + ncards='"$ncards"'; + idx=0; +} +/^snd-.*\.o$/{ + sub(/.o$/, ""); + driver=$0; + perc=(idx * 100) / (ncards + 1); + print int(perc); + idx++; +} +/^[]*PCI: /{ + gsub(/0x/, ""); + gsub(/=/, ":"); + x = sprintf ("'$LSPCI' -n 2>/dev/null| grep '"' 04..: '"' | grep %s", $2); + if (system (x) == 0) + printf "%s %s\n", $2, driver >>"'"$FOUND"'" +} +/^[]*ISAPNP: /{ + id2 = substr($0, index($0, "=")+1); + gsub(/=.*/, ""); + x = sprintf ("grep '\''^Card [0-9] .%s:'\'' '"$DUMP"'", $2); + if (system (x) == 0) + printf "%s %s\n", $2, driver >>"'"$FOUND"'" + else if (index($2, "ffff") > 0) { + x = sprintf ("grep '\''^BIOS [0-9]* .%s.'\'' '"$DUMP"'", id2); + if (system (x) == 0) + printf "%s %s\n", id2, driver >>"'"$FOUND"'" + } +}' < $CARDID_DB + + # + # PowerMac + # + if grep -q MacRISC /proc/cpuinfo; then + find /lib/modules/`uname -r` -name 'snd-powermac' -print | \ + while read i; do + i=${i##*/} + i=${i%%.o} + i=${i%%.ko} + echo "PowerMac $i" >> $FOUND + done + fi +} + +# set default mixer volumes +function set_mixers() { + [ -x /usr/bin/amixer ] || return + + /usr/bin/amixer -s -q <<_EOF +set Master 90% unmute +set 'Master Mono' 75% unmute +set Front 90% unmute +set Speaker 90% unmute +set PCM 90% unmute +mixer Synth 90% unmute +mixer CD 90% unmute +# mute mic +set Mic 0% mute +# ESS 1969 chipset has 2 PCM channels +set PCM,1 90% unmute +# Trident/YMFPCI/emu10k1 +set Wave 100% unmute +set Music 100% unmute +set AC97 100% unmute +# CS4237B chipset: +set 'Master Digital' 75% unmute +# Envy24 chips with analog outs +set DAC 90% unmute +set DAC,0 90% unmute +set DAC,1 90% unmute +# some notebooks use headphone instead of master +set Headphone 75% unmute +set Playback 100% unmute +# turn off digital switches +set "SB Live Analog/Digital Output Jack" off +set "Audigy Analog/Digital Output Jack" off +_EOF +} + +function ac_config_card() { + CARD_DRIVER=snd-$1 + CARD_OPTS="${*:2}" + + # soundcard already configured + grep -q "alias snd-card-0 $CARD_DRIVER" ${cfgout:-$cfgfile} 2>/dev/null && + { logmsg "$me" $"soundcard \"$CARD_DRIVER\" already configured" + return; } + + logmsg "$me" $"configuring soundcard \"$1\"" + + addcfg=`mktemp -q /tmp/alsaconf.XXXXXX` || + { logmsg "$me" $"error: "$"cannot create temporary files" + exit 1; } + + if ! grep -q char-major-116 /lib/modules/`uname -r`/modules.alias; then + [ "$cfgout" ] && + echo "# --- Generated by POSTPLUG, do not edit. ---" >> $addcfg || + echo "$ACB" >> $addcfg + + echo "\ +alias char-major-116 snd +alias char-major-14 $SOUND_CORE +alias sound-service-0-0 snd-mixer-oss +alias sound-service-0-1 snd-seq-oss +alias sound-service-0-3 snd-pcm-oss +alias sound-service-0-8 snd-seq-oss +alias sound-service-0-12 snd-pcm-oss" >> $addcfg + fi + +# echo "options snd device_mode=0666" >> $addcfg + + echo "\ +alias snd-card-0 $CARD_DRIVER +alias sound-slot-0 $CARD_DRIVER" >> $addcfg + + # apply workarounds for specific machines + case "${SYSTEM_MANUFACTURER}_${SYSTEM_PRODUCT_NAME}" in + "Hewlett-Packard_HP Compaq 6735s") + CARD_OPTS="$CARD_OPTS model=laptop" + ;; + esac + + [ "$CARD_OPTS" ] && echo "\ +options $CARD_DRIVER $CARD_OPTS" >> $addcfg + +# # load modem after soundcard in case of snd-intel8x0 card +# if [ "$CARD_DRIVER" = "snd-intel8x0" ]; then +# echo "\ +#options snd_intel8x0 index=0 +#options snd_intel8x0m index=1" >> $addcfg +# CONFIGURE_INTEL8x0=1 +# fi + + [ "$cfgout" ] || echo "$ACE" >> $addcfg + + cat $addcfg >> ${cfgout:-$cfgfile} + /sbin/depmod -a 2>/dev/null + + echo "SOUNDCARD0=\"$CARD_DRIVER\"" > $SYSCONFIG_SOUNDCARDS + +# if [ "$CONFIGURE_INTEL8x0" ]; then +# # reload modules in correct order +# cat /proc/modules | grep "snd_intel8x0 " >/dev/null && rmmod snd_intel8x0 +# cat /proc/modules | grep "snd_intel8x0m " >/dev/null && rmmod snd_intel8x0m +# modprobe snd_intel8x0 2>/dev/null +# modprobe snd_intel8x0m 2>/dev/null +# fi + + # (re)load driver + rmmod -f $CARD_DRIVER >/dev/null 2>&1 + modprobe $CARD_DRIVER >/dev/null 2>&1 + udevadm settle + + set_mixers + if [ -x /usr/sbin/alsactl ]; then + logmsg "$me" $"saving the mixer setup (/etc/asound.state)" + /usr/sbin/alsactl store >/dev/null 2>&1 + fi + + rm -f $addcfg +} + +if [ "$SOUND_BUILD_CARDID_DB_ONLY" ]; then + build_card_db $CARDID_DB + exit 0 +fi + +if [ "$SOUND_FORCE_RESCAN" != on ]; then + # audio device change detection + SOUND_DEV="`lspci -n | grep " 04[0-9][0-9]: "`" + [ "$SOUND_DEV" ] || exit 0 + + if [ -e $SYSCONFIG_SOUNDCARDS ]; then + if [ -e $postpluglibdir/sound.cache ]; then + SOUND_DEV_CACHED="`cat $postpluglibdir/sound.cache`" + [ "$SOUND_DEV" = "$SOUND_DEV_CACHED" ] && exit 0 + logmsg "$me" "warning: audio device appears to have changed; re-probing" + mv $SYSCONFIG_SOUNDCARDS $SYSCONFIG_SOUNDCARDS.postplug.save + else + [ -r $SYSCONFIG_SOUNDCARDS ] && . $SYSCONFIG_SOUNDCARDS + # soundcards already detected and configured + [ "$SOUNDCARD0" ] && { + [ -e $postpluglibdir/sound.cache ] || echo "$SOUND_DEV" > $postpluglibdir/sound.cache + exit 0 + } + fi + fi +fi + +FOUND=`mktemp -q /tmp/alsaconf.XXXXXX` || + { logmsg "$me" $"error: "$"cannot create temporary files"; exit 1; } +DUMP=`mktemp -q /tmp/alsaconf.XXXXXX` || + { logmsg "$me" $"error: "$"cannot create temporary files"; exit 1; } +TMP=`mktemp -q /tmp/alsaconf.XXXXXX` || + { logmsg "$me" $"error: "$"cannot create temporary files"; exit 1; } + +trap "rm -f $TMP $FOUND $DUMP" 0 1 2 5 15 + + +# populate the `$FOUND' file with the list of available PCI soundcards +probe_cards >/dev/null + +devs_found=() +if [ -s "$FOUND" ]; then + while read dev card ; do + /sbin/modprobe -a -l | grep -E $card'\.(o|ko)' >/dev/null 2>&1 || continue + devs_found=("${devs_found[@]}" "${card##snd-}") + done < "$FOUND" +fi + +case "$(uname -r)" in +2.6.*) + cfgfile="/etc/modprobe.conf" + [ -d /etc/modprobe.conf.d ] && cfgout="/etc/modprobe.conf.d/sound" + [ -d /etc/modprobe.d ] && cfgout="/etc/modprobe.d/sound.conf" + ;; +*) cfgfile="/etc/modules.conf" ;; +esac + + +ACB="# --- BEGIN: Generated by ALSACONF, do not edit. ---" +ACE="# --- END: Generated by ALSACONF, do not edit. ---" + +# remove ac block +if [ -e $cfgfile ]; then + awk '/^'"$ACB"'$/,/^'"$ACE"'$/ { next } { print }' < $cfgfile > $TMP + cat $TMP > $cfgfile +fi + +[ -e "$cfgout" ] && rm -f $cfgout + +if [ "$devs_found" ]; then + # FIXME : eventually check for TP600E soundcard + if [ "$devs_found" = "legacy" ]; then + # FIXME : no ISA cards supported for now + : # ac_config_legacy (alsaconf script) + else + logmsg "$me" $"detected PCI sound card(s) \"$devs_found\"" + ac_config_card "$devs_found" + fi +else + [ -d /usr/share/config/ ] && KCMARTSRC=/usr/share/config/kcmartsrc + [ -d /opt/kde3/share/ ] && KCMARTSRC=/opt/kde3/share/config/kcmartsrc + + [ "$KCMARTSRC" ] || + KCMARTSRC="$(kde-config --prefix 2>/dev/null)/share/config/kcmartsrc" + + [ -e "$KCMARTSRC" ] || + { logmsg "$me" $"creating $KCMARTSRC" + echo "\ +[Arts] +StartServer=false" > $KCMARTSRC; } +fi + +/sbin/modprobe -r isapnp >/dev/null 2>&1 +/sbin/modprobe -r isa-pnp >/dev/null 2>&1 + +echo "$SOUND_DEV" > $postpluglibdir/sound.cache + +exit 0 diff --git a/postplug.d/40modem b/postplug.d/40modem new file mode 100644 index 0000000..a70cf28 --- /dev/null +++ b/postplug.d/40modem @@ -0,0 +1,41 @@ +#!/bin/bash +# +# modem configuration plugin for postplug +# +# Copyright (c) 2008 by Silvan Calarco +# + +[ -r /etc/sysconfig/modem ] && . /etc/sysconfig/modem + +[ "$DEVICE" ] && exit 0 + +DEVICE=`grep "Modem" /proc/asound/pcm|sed "s|\([0-9]*\)-\([0-9]*\):.*|hw:\1,\2|"` + +if [ "$DEVICE" ]; then + ALSA=1 +else + ALSA=0 + DEVICE=/dev/slamr0 +fi + +[ "$COUNTRY" ] || { + case ${LANG:0:2} in + it) COUNTRY=ITALY ;; + fr) COUNTRY=FRANCE ;; + de) COUNTRY=GERMANY ;; + es) COUNTRY=SPAIN ;; + *) COUNTRY=UK ;; + esac +} + +cat > /etc/sysconfig/modem << _EOF +# +# Modem configuration used by the SLMODEM initscript +# +GROUP=dialout +COUNTRY=$COUNTRY +ALSA=$ALSA +DEVICE=$DEVICE +_EOF + +[ "$ALSA" = "1" ] && chkconfig --add slmodemd diff --git a/postplug.d/45updates b/postplug.d/45updates new file mode 100644 index 0000000..5ecd0c1 --- /dev/null +++ b/postplug.d/45updates @@ -0,0 +1,25 @@ +#!/bin/bash +# +# updates - perform one time updates at boot time using files in /etc/postplug/updates.d +# +# Copyright (c) 2010-2011 by Silvan Calarco +# + +me="updates" + +. /etc/postplug/postplug.defs + +for u in `ls /etc/postplug/updates.d/*.upd 2>/dev/null`; do + f=`basename $u` + grep $f $postpluglibdir/updates.cache 2>/dev/null >/dev/null || { + if [ ! -e $postpluglibdir/firsttime ]; then + logmsg "$me" "running updates script $u" + sh $u + [ $? -ne 0 ] && { + logmsg "$me" "error: $f update script failed with exit code $?" + continue + } + fi + echo "$f" >> $postpluglibdir/updates.cache + } +done diff --git a/postplug.d/91livecd b/postplug.d/91livecd new file mode 100644 index 0000000..77c8211 --- /dev/null +++ b/postplug.d/91livecd @@ -0,0 +1,30 @@ +#!/bin/bash +# +# livecd - livecd plugin for postplug +# Copyright (c) 2004-2007 by Davide Madrisan +# Copyright (c) 2007 by Silvan Calarco + +if [ $UID != 0 ]; then + echo "$0: must be superuser." >&2 + exit 1 +fi + +me="livecd" + +. /etc/postplug/postplug.defs + +if [[ "$LANG" = "en_US" ]]; then + [[ -e /home/qiuser/.kde/share/config/kdeglobals ]] && sed -i ' +s,Country=.*,Country=us, +s,Language=.*,Language=en,' /home/qiuser/.kde/share/config/kdeglobals +fi + +hostname="openmamba-livecd" +randname="$hostname-$(/usr/bin/mkpasswd -l 8 -d 0 -s 0 -C 0)" + +[[ -e /etc/sysconfig/network ]] && + sed -i "s,HOSTNAME=.*,HOSTNAME=$hostname," /etc/sysconfig/network +[[ -e /etc/dhclient.conf ]] && + sed -i "s,send host-name.*,send host-name \"$randname\";," /etc/dhclient.conf + +hostname $hostname diff --git a/postplug/postplug b/postplug/postplug new file mode 100644 index 0000000..c52331e --- /dev/null +++ b/postplug/postplug @@ -0,0 +1,89 @@ +#!/bin/bash +# +# postplug - Postplug boot time configuration script +# Copyright (c) 2004-2011 by Silvan Calarco +# Copyright (c) 2004-2007 by Davide Madrisan + +if [ $UID != 0 ]; then + echo "$0: must be superuser." >&2 + exit 1 +fi + +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 + exit 1; } + +. /etc/postplug/postplug.defs + +[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n + +export LANG +export LC_ALL=$LANG +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 +# NOTE: /proc/cmdline sintaxes: +# postplug=off : do not execute any plugins +# postplug=noxorg,nosound : skip these two plugins + +fin=/proc/cmdline +unset proc_pp_cmdline +if grep -qi "postplug=[a-zA-Z0-9]" $fin; then + proc_pp_cmdline=$(cat $fin | sed 's/.*postplug=\([^ ]*\).*/\1/') +fi + +function plugin_chkexec() { + OIFS="$IFS"; IFS=',' + for token in $proc_pp_cmdline; do + [ "${token}" = "no${1:2}" -o "${token}" = "off" ] && + { IFS="$OIFS"; return 0; } + done + IFS="$OIFS" + return 1 +} + +# evaluate valid vars and export them for plugins +OIFS="$IFS"; IFS=',' +for token in $proc_pp_cmdline; do + case ${token} in + freevideo|autoresvideo|lowresvideo) eval export ${token}=1 ;; + esac +done +IFS="$OIFS" + +for plugin in $(find /etc/postplug/rcpostplug.d/* 2>/dev/null | sort); do + # get the plugin basename + plugin_bn="${plugin##*/}" + + # check if the current plugin execution has been disabled + plugin_chkexec "${plugin_bn}" + + if [ $? -eq 1 ]; then + logmsg "${plugin_bn:2}" $"executing plugin" + $plugin || { + retval=$? + logmsg "\ +${plugin_bn:2}" $"error: "$"execution failed"" ($retval)"; } + fi + +done + +rm -f $postpluglibdir/firsttime + +exit 0 diff --git a/postplug/postplug-defs b/postplug/postplug-defs new file mode 100644 index 0000000..bb25723 --- /dev/null +++ b/postplug/postplug-defs @@ -0,0 +1,29 @@ +# +# common definitions and variables used by all the postplug plugins +# + +[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n + +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 +postplugnewdir=${postpluglibdir}/new + +function logmsg() { + local pluginame="${1:+ [$1]}" + local currtime="`LANG=C date +\"%b %d %H:%M:%S\" 2>/dev/null`" + + if [ -w "$logfile" ]; then + echo "$currtime `hostname` postplug${pluginame}: $2" >> $logfile + else + echo "$currtime `hostname` postplug${pluginame}: $2" + fi +} diff --git a/postplug/postplug-initscript b/postplug/postplug-initscript new file mode 100644 index 0000000..5d979b6 --- /dev/null +++ b/postplug/postplug-initscript @@ -0,0 +1,48 @@ +#!/bin/sh +# +# postplug This shell script enables the automatic startup of postplug +# Author: Silvan Calarco +# 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 diff --git a/postplug/postplug-logrotate b/postplug/postplug-logrotate new file mode 100644 index 0000000..0d2f876 --- /dev/null +++ b/postplug/postplug-logrotate @@ -0,0 +1,8 @@ +/var/log/postplug.log { + weekly + rotate 5 + copytruncate + compress + notifempty + missingok +} diff --git a/scripts/nvidia-autoselect-driver b/scripts/nvidia-autoselect-driver new file mode 100755 index 0000000..a59dfad --- /dev/null +++ b/scripts/nvidia-autoselect-driver @@ -0,0 +1,49 @@ +#!/bin/bash +# +# nVidia legacy test script +# +# Copyright (c) 2007 by Silvan Calarco +# Released under the GNU GPL v.3 license +# + + +PCIID=`/usr/sbin/lspci -n | grep " 0300: 10de:" | awk '{ print $3 }'` + +[ "$PCIID" ] || exit 0 + +DEVID=${PCIID/*:/} + +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' ;; + *) 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 +fi + +exit 0 diff --git a/sysconfig/postplug b/sysconfig/postplug new file mode 100644 index 0000000..0ed16c3 --- /dev/null +++ b/sysconfig/postplug @@ -0,0 +1,51 @@ +# add new detected non-removable disk partitions to /etc/fstab at boot time +# (yes/no, default: yes) +FS_PARTS_UPDATE=yes + +# configure detected partitions for automatic mounting on boot +# (yes/no, default: yes) +FS_PARTS_MOUNT=yes + +# dynamically add detected swap partitions to /etc/fstab at boot time +# (yes/no, default: yes) +FS_SWAP_UPDATE=yes + +# dinamically update the entries for /proc, /sys, devpts, tmpfs, usbfs +# (yes/no, default: yes) +FS_VFS_UPDATE=yes + +# dinamically update the entries for the floppy device +# (yes/no, default: no) +FS_FLOPPY_UPDATE=no + +# dinamically update the entries for the CDROM devices +# (yes/no, default: no) +FS_CDROM_UPDATE=no + +# remove entries from /etc/fstab for non-existing devices +# (yes/no, default: yes) +FS_NO_DEV_REMOVE=yes + +# run configuration wizard if a new network device is discovered +# (dialog/auto/off, default: off) +NETWORK_NEWDEVICE=auto + +# xorg server: automatically add DRI section +# (on/off, default: on) +XORG_ENABLE_DRI=on + +# xorg server: automatically enable 'Composite' extensions +# (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 + +# force sound card reconfiguration +# (on/off, default: off) +SOUND_FORCE_RESCAN=off