Smxi script
From TheLinuxVault
smxi is a general utility script that handles the standard system upkeep for Debian Sid based Sidux - kernel installs, dist-upgrade etc, package installs, cleanup, and graphics install. Has logging options, and will create logs on error of key parts. Debian testing conversions (Lenny, currently) can still be run using the script -C option, but are unsupported, but do basically work, if you follow the steps correctly. However, the official policy is to not support crossgrading from other distros.
Contents |
[edit] Features
- Script options. To see the list of available options, run the script with the -h option, like so: smxi -h
This will show a menu of the current options. Most of the options let you skip steps you might not need to use, for example: -kir would skip the kernel install, system information, script self updater. This would be useful in the case of just having installed a kernel and rebooting then running the script again. - Error Handling: apt-get update error handling. Hopefully this will help deal with those persistent corrupted bzip files in update pdiffs.
- Tests for all required programs the script uses as it runs, like unzip, grep, basename. If missing, offers to install, or exits.
- Script stores user choices so you don't get asked repeatedly to do one time only operations like fix-xorg and so on.
- Script tests for active internet connection, if absent, gives user a chance to install wifi modules if they just did a kernel install and lost internet. Also tests for nvidia or ati card and only offers correct driver choice now.
- Script checks for updates of itself automatically and installs them, then restarts again.
- Advanced and Standard kernel install options, let's you pick which kernel version you want to install, from very latest to an older one, SMP or UP. Supports 32 and 64 bit kernels.
- Debian Mirror Updating: The first time you run > 3.6 versions of the script you will see an option to pick your debian source mirror location. After the first time, you can start the script with the -m option change the Debian mirrors used in /etc/apt/sources.list. You will see a list of all available country mirrors, select the number you want, and your sources.list will be updated for you. Changing your mirror is highly recommended for people who do not live in Germany. Sidux uses German mirrors unless you change them.
- dist-upgrade warning system. Warns users about major issues that may break their installs. Stops dist-upgrade from proceeding when there is a warning flag present.
- apt-get features - keyring install, gpg setting, apt-get update with error handling, dist-upgrade with error handling, fixes for sid problems run either before or after the main dist-upgrade.
- Miscelleous Tweaks: Dump gtk - option in Miscellaneous Tweaks to get rid of the firefox/thunderbird/icedove/iceweasel default gtk file handler dialogue boxes, you know the ones, where you have to click too many times to get anywhere in your file system, with the silly useless autocomplete etc. Run it and those gtk dialogues are replaced by some more useable ones. Also lets you start/stop splashy.
- Package Install: Openoffice.org installer. Full featured, lets you select your language, then automatically installs any related language items like thesaurus, dictionary, or ooo help. Also option for which desktop integration package you want, kde or gnome.
- System cleanup. With apt-get clean and autoclean option, kernel-removal options, and script backup file cleanup option, and Remove extra unused xorg modules. Xorg module removal tool will let you keep any or all of the unnecessary modules. All modules removed are logged to: /var/log/clean_xorg_modules.log so you can easily reinstall them.
- Graphics Install: Makes an attempt to show currently installed fglrx/nvidia driver version number. Should work for most users most of the time, but not always. Graphics Install supports ATI fglrx and nVidia binary driver install. You will see a list of the drivers, legacy to latest release, that your card supports, please read any warnings or advice before you proceed.
[edit] Installation
- Preferred method: Use the built in script installers. To get this, run this simple command:
apt-get update apt-get install sidux-scripts
This will install the latest self installers for smxi and sgfxi. To start the script, simply type in its name as root, in init 3: smxi and it will download and install itself automatically. - If you really want to do it manually, maybe to get your apt also configured before running apt-get update, you can use wget to download it; hint: copy and paste this directly into your console window, after logging in as su in console, then just run the lines below:
wget -NqO /usr/local/bin/smxi http://techpatterns.com/smxi
- Then make it executable:
chmod +x /usr/local/bin/smxi
- Script must be located in /usr/local/bin to run correctly. Please do not put it anywhere else!
Please note, no parts of step 2 are required if you use method 1, it will do it all automatically after you get the latest sidux-scripts version.
[edit] Execution
- Script must run in root user mode, and in runlevel 3
In order to have this work in the safest way possible, please enter runlevel 3 before running it. It will test if you are in runlevel 3 anyway, but make it easy and make sure you are completely out of run level 5 before executing the script:
You can do that by:# use the: ctrl+alt+f1 method to enter console. This is not runlevel 3 <br>#type: <br>init 3 <br># or in console, switch to su, then type: init 3 <br>su <br><password> <br>init 3
- Once in Runlevel 3, execute the script:
smxi
[edit] Usage
You can see the following information any time by simply running this command, assuming that the script has already been installed on your system: smxi -h
================================================================== OPTION HELP MENU: smxi ================================================================== Options: together: -deghiIklmrstuwWx or separated: -giktw -f -x You can run this script with any combination of these options. You can put them together, like this: -ik, or separate, like this: -w -x Each option, or group of options, must begin with a - Example: smxi -ikw skips the system info, kernel install, and warning. ------------------------------------------------------------------ The following allow you skip parts of the du script: -d Skips dist-upgrade if you also select the w option. -e Skips some of the 'Please hit enter to continue' questions. -g Skips the graphics install question. -i Skips the system information section. -k Skips the kernel install question. -r Skips check for latest, restart, and downloading latest script version. This skips the restart of the script, that is. Not recommended for most users except when they are rebooting from a fresh kernel install and running the script again. -s Skips some parts of script that require an internet connection. Avoid using this since it disables almost all script functionality. -S Skips the internet connection test. Use this if script fails connection test but you know your connection is fine. -t Skips the Post dist-upgrade options section. -w Skips the du warnings section. The following are advanced script options: -E Will use the European sidux kernel mirror: http://debian.tu-bs.de/project/sidux/kernel/ instead of the default USA based one. Only the default has older or -K option kernels. -I Sets different Init level for X restart. Requires this syntax: -I 3 Please note, the number is the init level you want the script to start x in. -K Advanced Kernel Install. If newer test kernels are available, they will show in the kernel install options. Install advanced kernels at your own risk! -l Creates time stamped logs of all update and dist-upgrade data. Logfiles are located in /var/log/smxi/ -m Runs the option to change debian mirrors in /etc/apt/sources.list -p Runs apt-get update without using pdiffs. Good for fast connections. -P Run script with Proxy settings for connection, requires this syntax: -P http://[<username><:password>@]<server><:port> Argument is required. -u Forces an update of script before it runs again. -x Runs extra script features that are not core to central functionality. -h Prints this Help menu. ------------------------------------------------------------------ Remember: to scroll up or down in terminal window, use: shift+pageup/pagedown ------------------------------------------------------------------
[edit] Script Steps
- Script checks user is root and in init 3
- Script checks for internet connection.
- Script checks that it is the latest version of itself, then upgrades itself if not.
- Script tests for distro version, and exits if it's older than the currently supported previous version.
- If it's the first time you've run the script, it will ask you if you want to keep your settings/choices. Say 'y' unless you have some reason not to. This will make it only ask certain questions one time. If you want to delete these settings, simple delete this file: /etc/smxi.conf and it will go back to default.
- If it is the first time you run the script, script will let you change your default Debian apt mirror source location. The default is <a href="http://ftp.de.debian.org,">ftp.de.debian.org,</a> but it's usually faster to use your local ones. You can always change to any mirror you want by starting the script using the -m option.
- Install kernel is an option if you want to upgrade your kernel first. New kernel will not be live until you reboot. I recommend you reboot then run the script again to complete the upgrade. You cannot install video drivers until you reboot, for example.
Features an advanced option that lets you pick from a list of other kernels, including all the SMP ones (symmetrical multi processor).
NOTE: kernel material will be placed in /usr/src/kernel-downloads/<kernel name, like: 2.6.20-slh-smp-2>. This is where all the extra modules etc for that kernel are located. - Script stops to deliver warnings of dist-upgrade dangers, and give a short warning message about what the danger is, with options of what to do next.
- Script does apt-get update, and updates your pgp keyrings [sidux-keyrings] and updates again.
- After this, dist-upgrade will begin.
Important - KEEP CURRENT CONFIG FILES: Right before the dist-upgrade begins, you may see a list of files to say 'y' to when the dist-upgrade process asks if you want to use the new version or keep your current configuration file (y means use new version, and n means keep currently installed config file.) Please take a look at those before you proceed.
For all other configuration file options, always choose the 'n' option, or keep current config file. Sometimes you say 'ok' to do that, sometimes 'cancel', but usually it's the plain text 'n' that you want.
You may also see questions in blue boxes, that asks if you want to update or change your keyboard layout and other things, default is no, keep it as no or you may run into issues. Make sure to read those, and chose the option that makes you keep your current configs. - After the first dist-upgrade finishes, you will see either an error message letting you know you need to run install -f / dist-upgrade again, or just the normal continue screen with the list of options available. If no error occured (errors appear in yellow text), it's usually safe to just enter the 'continue' option.
If you got errors on dist-upgrade, run the apt-get install -f '1' / dist-upgrade '2' options as many times as you need to run it to get rid of errors. Keep running these until you get no errors. Nothing happens when you run it again if it's done, so do it one extra time to make sure.
The script has error handling, so unless you see a yellow error warning after update or dist-upgrade, it's fairly safe to assume that it finished fine. - Once you're sure the whole dist-upgrade is set, and click the '3' for continue and the script will continue on its way.
- Next you will see some Post Dist-upgrade options:
- Install packages lets you install or reinstall packages like skype, streamtuner, ekiga/gnomemeeting.
- Remove packages lets you completely remove packages like koffice, gnomemeeting, isdn, etc.
- fix-fonts, with or without the -e option, adjusts your system fonts. If you want to do that, do it. If you are moving up a major xorg version, run the -e option.
I only do this once in a while, after a major xorg update. If you've never done an upgrade, you should probably run this, otherwise, if you've run it before, try not using it.
- Miscellaneous Tweaks: You can do various things, modify/update infobash, splashy, etc. Options added as required.
- System Cleanup: cleanup system, non needed kernel removal tools, remove backups of files.
- Install packages lets you install or reinstall packages like skype, streamtuner, ekiga/gnomemeeting.
- The last real step is to install your nvidia or radeon/fglrx drivers. Type in the menu number + <enter> to choose the driver you want to install, or to continue to end. You can also run this graphics installer as a standalone application, by typing in: sgfxi but you won't see as many options or features.
If you don't see any drivers offered for your card, it means that your card is not supported and will need to use the native xorg nv or ati drivers, which are fine for older cards.
- And that's it. You can choose to start your windows manager after you're done if you want, or just exit the script.

