LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Microlinux / MLED (https://www.linuxquestions.org/questions/microlinux-mled-116/)
-   -   MLED installation script as a proof-of-concept (https://www.linuxquestions.org/questions/microlinux-mled-116/mled-installation-script-as-a-proof-of-concept-4175561149/)

gegechris99 12-10-2015 10:42 AM

MLED installation script as a proof-of-concept
 
Dear MLED users,

The MLED installation guide has been criticized by some as being too complex/user-unfriendly. Having an installation script was deemed by those critics as a more appropriate solution for a professional-level project.

My opinion is that the MLED installation guide (http://www.microlinux.eu/installation_guide.php) is quite good. It is a bit long because Niki (the MLED founder) provides lots of explanations. I found nothing in this guide that would deter a person who is able to install Slackware. For me, end of the story.

But out of curiosity, I wrote a proof-of-concept script to help identify any blocking point/pitfall/risk and maybe some areas for improvement when automating the set of MLED installation commands.

You may consider such an exercice a moot point. If so, please stop reading.

For a start, I assume that the user will have an internet connection and that the installation steps would be:

1) Install Slackware by tag or full installation (OK full installation is not efficient but it would work thanks to trim.sh later)
2) Run the MLED installation script
3) Configure MLED

My focus here is on step 2. So we assume that we are using a running slackware machine with internet connection after step 1.

My scripting skills are quite basic, please forgive me for bad programming/errors.

I didn't run the full script, it's just a proof-of-concept. What I found out:

- First pitfall: the script can download slackpkg+ using wget but a mirror must be selected for slackpkg+. Either a default mirror could be used or the script may request the user to enter the mirror. In my script, I played with defining a default mirror based on the continent where the machine is located.

- Second pitfall: after upgrading the base installation using slackpkg+, there is a need to check .new config files. At this point, the user will have to decide whether or not to update the configuration files. I find it dangerous for a script to automatically force the replacement of all configuration files with the new ones (or to keep all the old ones).

- Third pitfall: the update of the base installation may result in a new kernel being installed. This should be OK if the MLED installation just follows the default Slackware installation (which uses the huge kernel). But if the Slackware base installation is already running the generic kernel, a new generic kernel would require specific actions: create a new initrd file, update lilo.conf (if needed) and run lilo. This case is not treated in the script. I don't know how slackpkg+ would handle this case in batch mode (I guess that lilo would be run). Anyhow the topic of the generic kernel is addressed in the configuration step of MLED.

- Risk: error management needs to be carefully thought out to handle errors during each of the installation steps.

Based on the above, I have a better understanding why Niki only provided an installation guide rather than an installation script.

Anyhow, I like my script ;) So I will most probably use it the next time I install MLED just for the fun of it :)

Finally here's the script. Your comments are welcome:
Code:

#!/bin/sh
#
# Script to automate the installation of MLED
#
# The script should be run as root on a x86 or x86_64 Slackware system
#

ROOT_UID=0        # Only users with $UID 0 have root privileges
E_NOT_ROOT=87        # Non-root exit error

# Colors
BLUE="\033[01;34m"
GREEN="\033[01;32m"
RED="\033[01;31m"
RESET="\033[00m"

# Make sure only root can run this script
if [ $EUID -ne "$ROOT_UID" ]; then
  echo -e $RED"This script must be run as root"$RESET 1>&2
  exit $E_NOTROOT
fi

# Detect system architecture
case "$(uname -m)" in
  x86_64)
    ARCH="64bit"
    SLACKDIR="Slackware64"
    MULTILIB=${MULTILIB:-yes}
    ;;
  i?86)
    ARCH="32bit"
    SLACKDIR="Slackware"
    MULTILIB="No"
    ;;
  *)
    echo -e $RED"\nUnsupported system architecture: "$(uname -m) \
            "\n\nMLED installation is cancelled\n\nGoodbye"$RESET
    exit 1
    ;;
esac

# Get Slackware version
if [ -e /etc/slackware-version ]; then
  VERSION=${VERSION:-`cat /etc/slackware-version | cut -f 2 -d " "`}
else
  echo -e $RED"\nYou are not running Slackware" \
            "\n\nMLED installation is cancelled\n\nGoodbye"$RESET
  exit 1
fi

# If MIRROR variable is not set when the script is called, then
#  Define a mirror based on the continent in which the machine is located
MIRROR=${MIRROR:-None}
CONTINENT=$(echo `readlink /etc/localtime-copied-from | \
            rev | cut -f 2 -d "/" | rev`)
if [ "$MIRROR" = "None" ]; then
  if [ "$CONTINENT" = "Africa" ]; then
    MIRROR="http://slackware.mirror.ac.za/"$SLACKDIR-$VERSION"/"
  elif [ "$CONTINENT" = "America" ]; then
    MIRROR="http://slackware.osuosl.org/"$SLACKDIR-$VERSION"/"
  elif [ "$CONTINENT" = "Asia" ]; then
    MIRROR="http://ftp.twaren.net/Linux/Slackware/"$SLACKDIR-$VERSION"/"
  elif [ "$CONTINENT" = "Europe" ]; then
    MIRROR="ftp://ftp.fu-berlin.de/unix/linux/slackware/"$SLACKDIR-$VERSION"/"
  else
    MIRROR="http://mirrors.slackware.com/slackware/slackware/"$SLACKDIR-$VERSION"/"
    echo -e "\nMirror will be automatically selected using\n"$MIRROR"\n"
  fi
fi

# Summarize parameters before confirming the start of MLED installation
echo -e "\nMLED installation parameters:"
echo -e "\n\tOperating system: Slackware "$VERSION" "$ARCH
echo -e "\n\tMirror for slackpkg+: "$MIRROR
echo -e "\n\tMultilib installation: "$MULTILIB"\n"

read -p "Do you want to continue with MLED installation [y|N]? " ANSWER

if [ ! "$ANSWER" = "y" ]; then
  echo -e "\nMLED installation is cancelled\n\nGoodbye :)\n"
  exit 0
fi

echo -e $BLUE"\nStarting MLED installation..."$RESET

# temporary exit for debugging
#exit

# Exit script immediately if a command exits with a non-zero status
set -eu

# Go to root home directory
cd
CWD=$(pwd)

# Get MLED installation tools
echo -e $BLUE"\n\nDownload MLED installation tools:"$RESET
git clone https://github.com/kikinovak/microlinux
echo -e $GREEN"\nMLED installation tools have been downloaded"$RESET

# Download and install package slackpkg+
echo -e $BLUE"\n\nInstall slackpkg+ package:"$RESET
wget -r -l1 -np -nH --cut-dirs=3 -A "slackpkg+*_microlinux.txz" \
  http://www.microlinux.fr/microlinux/desktop-$VERSION-$ARCH/$SLACKDIR/
installpkg slackpkg+*_microlinux.txz 
# Add the default mirror at end of /etc/slackpkg/mirrors
ADD_MIRROR="# Mirror selected during MLED installation:\n"$MIRROR
sed -i.orig '$ a '"$ADD_MIRROR" /etc/slackpkg/mirrors
echo -e $GREEN"\nslackpkg+ package has been installed"$RESET

# Update slackpkg
echo -e $BLUE"\n\nUpdate slackpkg package list:"$RESET
slackpkg update gpg
slackpkg update
echo -e $GREEN"\nslackpkg package list has been updated"$RESET

# Trim Slackware packages
echo -e $BLUE"\n\nTrim the base installation:"$RESET
$CWD/microlinux/desktop-$VERSION-$ARCH/tools/trim.sh
echo -e $GREEN"\nThe base installation has been trimmed"$RESET

# Install extra packages
echo -e $BLUE"\n\nInstall extra Slackware packages:"$RESET
slackpkg -batch=on -default_answer=y install mplayerplug-in recordmydesktop
echo -e $GREEN"\nExtra Slackware packages have been installed"$RESET

# Upgrade Slackware packages
echo -e $BLUE"\n\nUpgrade the base installation:"$RESET
slackpkg -batch=on -default_answer=y upgrade-all
# Manage .new configuration files
# user interaction is expected at this step
slackpkg new-config
echo -e $GREEN"\nThe base installation has been upgraded"$RESET

# Install multilib packages
if [ "$MULTILIB" = "yes" ]; then
  echo -e $BLUE"\n\nInstall the multilib packages:"$RESET
  slackpkg -batch=on -default_answer=y install multilib
  echo -e $GREEN"\nMultilib packages have been installed"$RESET
fi

# Install MLED packages
echo -e $BLUE"\n\nInstall the MLED packages:"$RESET
slackpkg -batch=on -default_answer=y install microlinux-desktop
echo -e $GREEN"\nMLED packages have been installed"$RESET

echo -e $GREEN"\n\nMLED installation is now completed" \
        "\n\nYou can now proceed with MLED configuration"$RESET


kikinovak 12-10-2015 12:41 PM

Quote:

Originally Posted by gegechris99 (Post 5462481)
- First pitfall: the script can download slackpkg+ using wget but a mirror must be selected for slackpkg+. Either a default mirror could be used or the script may request the user to enter the mirror. In my script, I played with defining a default mirror based on the continent where the machine is located.

- Second pitfall: after upgrading the base installation using slackpkg+, there is a need to check .new config files. At this point, the user will have to decide whether or not to update the configuration files. I find it dangerous for a script to automatically force the replacement of all configuration files with the new ones (or to keep all the old ones).

- Third pitfall: the update of the base installation may result in a new kernel being installed. This should be OK if the MLED installation just follows the default Slackware installation (which uses the huge kernel). But if the Slackware base installation is already running the generic kernel, a new generic kernel would require specific actions: create a new initrd file, update lilo.conf (if needed) and run lilo. This case is not treated in the script. I don't know how slackpkg+ would handle this case in batch mode (I guess that lilo would be run). Anyhow the topic of the generic kernel is addressed in the configuration step of MLED.

- Risk: error management needs to be carefully thought out to handle errors during each of the installation steps.

Based on the above, I have a better understanding why Niki only provided an installation guide rather than an installation script.

Hi gegechris99,

First of all, thanks very much for your contribution to MLED.

The script actually looks quite good. Early versions of MLED (called "Slick" at the time) had such an installer, and there was even a time when they came on a separate installation ISO. As far as I'm concerned, I've come to prefer the manual installation method, along with a step-by-step documentation. Different ways lead to Saint-Bauzille-de-Putois (my favourite climbing spot, for those who wonder). Let's just say my own installation script always ended up to work like this:

https://www.youtube.com/watch?v=E2evC2xTNWg :)

One technical detail: if you don't want to use the tagfiles at install time, the best solution is to go for a full install minus E, KDE and KDEI. Afterwards, the trim.sh script can take care of removing the handful of unnecessary packages from X and XAP.

I'll give your script a spin as soon as I find some time and my never-ending TODO list gets slightly shorter. Of course, I'll encourage everyone to fiddle with this script and report back to gegechris99. If it works well, I'll happily include it as an "official" installation script alongside the traditional installation method.

Cheers from the sunny South of France,

Niki

Bertman123 12-12-2015 08:42 AM

This looks nice, thanks. I'll give this a spin as well. I have an extra hard drive laying around and I'll try this script out and see how it goes.

PROBLEMCHYLD 02-04-2016 06:55 PM

Your script seems to be a time saver. What about adding virtualbox since its another step to do in the configure section of MLED? It would be one less command we have to do. I have created packages for Windows, so I know the difference between laziness and convenience. Here is my site http://www.htasoft.com/u98sesp/
I'm triple booting Win98/XP/Slackware MLED. I have done some reading, and a lot of unix/dos uses some of the same commands. I might have some feedback/input in the future for ya.

Code:

# Install extra packages
echo -e $BLUE"\n\nInstall extra Slackware packages:"$RESET
slackpkg -batch=on -default_answer=y install mplayerplug-in recordmydesktop
echo -e $GREEN"\nExtra Slackware packages have been installed"$RESET

Quote:

- Second pitfall: after upgrading the base installation using slackpkg+, there is a need to check .new config files. At this point, the user will have to decide whether or not to update the configuration files. I find it dangerous for a script to automatically force the replacement of all configuration files with the new ones (or to keep all the old ones).
It would be ideal to have the .new config files replaced the older ones, right? When one is doing a clean install, the default files are replaced with newer default ones. Or, is this not the case? Maybe you can update your script to reflect this.

Thank you for your contribution.:hattip::cool:

gegechris99 02-05-2016 04:24 PM

Quote:

Originally Posted by PROBLEMCHYLD (Post 5495383)

It would be ideal to have the .new config files replaced the older ones, right? When one is doing a clean install, the default files are replaced with newer default ones. Or, is this not the case? Maybe you can update your script to reflect this.

I wouldn't want the .new config files to replace automatically the installed config files even when doing a fresh install of MLED because of the /etc/group, /etc/passwd and /etc/shadow files contained in package a/etc.

These files contain information about login and passwd of your existing users including the root user. So even during an initial installation, this script will run after Slackware has been installed and the root password is set (selection of root password is part of the Slackware installation process).

There might be other cases where config files are modified during the Slackware installation process after the packages have been installed (ex: /etc/lilo.conf).

This script is focused on installing the MLED add-on and could therefore also be used with an existing Slackware installation and in this case, you definitely don't want to automatically overwrite existing config files.

However the script is a proof-of-concept for now so there is room for further improvement but first I'd like to run it once for real which I haven't.

[EDIT]
Anyway slackpkg new-config allows you to mass-overwrite all config files with .new ones if you don't want to check individually each .new file: press "O" when asked the first question.
[/EDIT]

PROBLEMCHYLD 02-05-2016 05:22 PM

Quote:

Originally Posted by gegechris99 (Post 5495941)
This script is focused on installing the MLED add-on and could therefore also be used with an existing Slackware installation and in this case, you definitely don't want to automatically

I understand, but my goal is to try and help automate the task. Nobody, newbie or connoisseur wants to have to type 100 commands (exaggeration) just to get their system up and running. You have most of the foundation set, we just need to build on it, if interested. I have some ideas. If you have checked the link to my site, you'll see I'm not new to the computer world, but to linux.

gegechris99 02-06-2016 04:19 AM

Any input/comment on this draft script is welcome. It's just that in the case of .new config files, I find it dangerous to automatically overwrite old config files (see my reason in my previous post).

I do not doubt your computer skills. More generally I would not comment in this forum on such a matter.

Not being a native english speaker, I may appear to be patronizing in my explanations (which could be shorter) but that's not the purpose.

Finally I will look into how to add a step for optionally installing virtualbox. I don't use this software but I understand that it needs multilib in a 64bit machine. So the scnript will have to make some basic checks like if I want to install virtualbox on a 64bit machine, I need to force the installation of multilib (it's not that difficult). I will try to publish something later this week-end.

PROBLEMCHYLD 02-06-2016 09:27 AM

If you were to add to the script, something like this, it would get rid of pitfall 1.

Code:

sed -i 's/# UNITED STATES (US)/UNITED STATES (US)/g' exact location/mirrors
it would uncomment a mirror. Your script already has this. The user would have to answer a question such as

Code:

What is your location, or the nearest to your location?
User would have to enter US or FR, or whatever the location is.

The script would then go to the first HTTP mirror and use it. If the link is dead, the script would go to the next HTTP mirror and so on and so forth.
If all HTTP mirrors have dead links, then we would use ftp mirrors. Using the same method above. Or you can give users the option of choosing a default between ftp and http. I thought http was faster is why it was suggested as the first and default option.

# UNITED STATES (US)
# fxp://carroll.aset.psu.edu/pub/linux/distributions/slackware/slackware-14.1
# hxxp://carroll.aset.psu.edu/pub/linux/distributions/slackware/slackware-14.1
# FRANCE (FR)
# fxp://mirror.ovh.net/mirrors/ftp.slackware.com/slackware-14.1
# hxxp://mirror.ovh.net/mirrors/ftp.slackware.com/slackware-14.1

This is what I have. Hope you understand where I'm coming from.

PROBLEMCHYLD 02-09-2016 11:50 AM

Quote:

Originally Posted by gegechris99 (Post 5496140)
Finally I will look into how to add a step for optionally installing virtualbox. I don't use this software but I understand that it needs multilib in a 64bit machine. So the scnript will have to make some basic checks like if I want to install virtualbox on a 64bit machine, I need to force the installation of multilib (it's not that difficult). I will try to publish something later this week-end.

Would adding a #comment in front of virtualbox prevent it from installing?

Code:

slackpkg -batch=on -default_answer=y install mplayerplug-in recordmydesktop #virtualbox
A small issue you can fix in the future, I have done it already because I'm converting a lot of Windows to Slackware.

Code:

# Detect system architecture
case "$(uname -m)" in
  x86_64)
    ARCH="64bit"
    SLACKDIR="Slackware64"
    MULTILIB=${MULTILIB:-yes}
    ;;
  i?86)
    ARCH="32bit"
    SLACKDIR="Slackware"
    MULTILIB="No"

You must change Slackware to slackware. Its case sensitive, and if you don't you'll get an 404 error.

gegechris99 02-09-2016 04:09 PM

Thanks PROBLEMCHYLD for the error reporting. I corrected it.

I wanted to edit my original post to put back the correction but there is no EDIT button on this post even though it's available in my other posts in this thread. Anyway, here's below the updated script with an option to install virtualbox.

Note on virtualbox: the syntax you proposed with the "#" returns an error with slackpkg. Anyway I wanted the installation of virtualbox to be an option (I don't use it for example). So installation is managed via a flag VBOX that defaults to "no". To install vbox, you'll run the script as this:
Code:

VBOX="yes" myscript.sh
I understand that virtualbox on a Slackware64 machine requires the multilib packages. That explains why I force multilib installation when virtualbox is installed. Maybe a vbox user on Slackware64 could confirm or not this requirement.

Also regarding your post about managing the mirrors, I admit that it's a bit difficult for me to see where you want to go. Some more thinking is needed on my part before going further on this mirror topic. But if you fell like explaining further, don't hesitate as I may be slow to understand sometimes :)

Code:

#!/bin/sh
#
# Script to automate the installation of MLED
#
# The script should be run as root on a x86 or x86_64 Slackware system
#

ROOT_UID=0        # Only users with $UID 0 have root privileges
E_NOT_ROOT=87        # Non-root exit error

# Colors
BLUE="\033[01;34m"
GREEN="\033[01;32m"
RED="\033[01;31m"
RESET="\033[00m"

# Make sure only root can run this script
if [ $EUID -ne "$ROOT_UID" ]; then
  echo -e $RED"This script must be run as root"$RESET 1>&2
  exit $E_NOTROOT
fi

# Flag to install Virtualbox as an option
VBOX=${VBOX:-no}

# Detect system architecture
case "$(uname -m)" in
  x86_64)
    ARCH="64bit"
    SLACKDIR="slackware64"
    # Force installation of multilib packages if Virtualbox is installed
    if [ "$VBOX" = "yes" ]; then
      MULTILIB="yes"
    else
      MULTILIB=${MULTILIB:-yes}
    fi
    ;;
  i?86)
    ARCH="32bit"
    SLACKDIR="slackware"
    MULTILIB="No"
    ;;
  *)
    echo -e $RED"\nUnsupported system architecture: "$(uname -m) \
            "\n\nMLED installation is cancelled\n\nGoodbye"$RESET
    exit 1
    ;;
esac

# Get Slackware version
if [ -e /etc/slackware-version ]; then
  VERSION=${VERSION:-`cat /etc/slackware-version | cut -f 2 -d " "`}
else
  echo -e $RED"\nYou are not running Slackware" \
            "\n\nMLED installation is cancelled\n\nGoodbye"$RESET
  exit 1
fi

# If MIRROR variable is not set when the script is called, then
#  Define a mirror based on the continent in which the machine is located
MIRROR=${MIRROR:-None}
CONTINENT=$(echo `readlink /etc/localtime-copied-from | \
            rev | cut -f 2 -d "/" | rev`)
if [ "$MIRROR" = "None" ]; then
  if [ "$CONTINENT" = "Africa" ]; then
    MIRROR="http://slackware.mirror.ac.za/"$SLACKDIR-$VERSION"/"
  elif [ "$CONTINENT" = "America" ]; then
    MIRROR="http://slackware.osuosl.org/"$SLACKDIR-$VERSION"/"
  elif [ "$CONTINENT" = "Asia" ]; then
    MIRROR="http://ftp.twaren.net/Linux/Slackware/"$SLACKDIR-$VERSION"/"
  elif [ "$CONTINENT" = "Europe" ]; then
    MIRROR="ftp://ftp.fu-berlin.de/unix/linux/slackware/"$SLACKDIR-$VERSION"/"
  else
    MIRROR="http://mirrors.slackware.com/slackware/slackware/"$SLACKDIR-$VERSION"/"
    echo -e "\nMirror will be automatically selected using\n"$MIRROR"\n"
  fi
fi

# Summarize parameters before confirming the start of MLED installation
echo -e "\nMLED installation parameters:"
echo -e "\n\tOperating system: Slackware "$VERSION" "$ARCH
echo -e "\n\tMirror for slackpkg+: "$MIRROR
echo -e "\n\tMultilib installation: "$MULTILIB
echo -e "\n\tVirtualbox installation: "$VBOX"\n"

read -p "Do you want to continue with MLED installation [y|N]? " ANSWER

if [ ! "$ANSWER" = "y" ]; then
  echo -e "\nMLED installation is cancelled\n\nGoodbye :)\n"
  exit 0
fi

echo -e $BLUE"\nStarting MLED installation..."$RESET

# Exit script immediately if a command exits with a non-zero status
set -eu

# Go to root home directory
cd
CWD=$(pwd)

# Get MLED installation tools
echo -e $BLUE"\n\nDownload MLED installation tools:"$RESET
git clone https://github.com/kikinovak/microlinux
echo -e $GREEN"\nMLED installation tools have been downloaded"$RESET

# Download and install package slackpkg+
echo -e $BLUE"\n\nInstall slackpkg+ package:"$RESET
wget -r -l1 -np -nH --cut-dirs=3 -A "slackpkg+*_microlinux.txz" \
  http://www.microlinux.fr/microlinux/desktop-$VERSION-$ARCH/$SLACKDIR/
installpkg slackpkg+*_microlinux.txz 
# Add the default mirror at end of /etc/slackpkg/mirrors
ADD_MIRROR="# Mirror selected during MLED installation:\n"$MIRROR
sed -i.orig '$ a '"$ADD_MIRROR" /etc/slackpkg/mirrors
echo -e $GREEN"\nslackpkg+ package has been installed"$RESET

# Update slackpkg
echo -e $BLUE"\n\nUpdate slackpkg package list:"$RESET
slackpkg update gpg
slackpkg update
echo -e $GREEN"\nslackpkg package list has been updated"$RESET

# Trim Slackware packages
echo -e $BLUE"\n\nTrim the base installation:"$RESET
$CWD/microlinux/desktop-$VERSION-$ARCH/tools/trim.sh
echo -e $GREEN"\nThe base installation has been trimmed"$RESET

# Install extra packages
echo -e $BLUE"\n\nInstall extra Slackware packages:"$RESET
slackpkg -batch=on -default_answer=y install mplayerplug-in recordmydesktop
echo -e $GREEN"\nExtra Slackware packages have been installed"$RESET

# Upgrade Slackware packages
echo -e $BLUE"\n\nUpgrade the base installation:"$RESET
slackpkg -batch=on -default_answer=y upgrade-all
# Manage .new configuration files
# user interaction is expected at this step
slackpkg new-config
echo -e $GREEN"\nThe base installation has been upgraded"$RESET

# Install multilib packages
if [ "$MULTILIB" = "yes" ]; then
  echo -e $BLUE"\n\nInstall the multilib packages:"$RESET
  slackpkg -batch=on -default_answer=y install multilib
  echo -e $GREEN"\nMultilib packages have been installed"$RESET
fi

# Install MLED packages
echo -e $BLUE"\n\nInstall the MLED packages:"$RESET
slackpkg -batch=on -default_answer=y install microlinux-desktop
echo -e $GREEN"\nMLED packages have been installed"$RESET

# Install virtualbox packages
if [ "$VBOX" = "yes" ]; then
  echo -e $BLUE"\n\nInstall the virtualbox packages:"$RESET
  slackpkg -batch=on -default_answer=y install virtualbox
  echo -e $GREEN"\nVirtualbox packages have been installed"$RESET
fi

echo -e $GREEN"\n\nMLED installation is now completed" \
        "\n\nYou can now proceed with MLED configuration"$RESET


PROBLEMCHYLD 02-10-2016 05:28 PM

I just ran the updated script and everything went smoothly. I named it mledauto.sh and just let it flow on a clean install. All I had to do was answer a few prompts, which isn't so bad. No errors at all. When I click (O) to overwrite the old config files, nothing was changed as far as password settings. I'm not sure I understand where you coming from on the config files. But anyway, everything is working lovely. Thank you very much. I will report back later.

gegechris99 02-11-2016 03:27 PM

Quote:

Originally Posted by PROBLEMCHYLD (Post 5498314)
Thank you very much

You're welcome. It's great to hear that someone has successfully used the script. Maybe I no longer have to call it a proof-of-concept :)

Quote:

Originally Posted by PROBLEMCHYLD (Post 5498314)
When I click (O) to overwrite the old config files, nothing was changed as far as password settings. I'm not sure I understand where you coming from on the config files.

I understand that you installed Slackware 14.1 and then used the script you named mledauto.sh to install MLED add-on.

The part in the script that deals with .new config files comes after you have upgraded the packages of the base Slackware installation. Package a/etc (that contains files /etc/group, /etc/passwd and /etc/shadow) has not been upgraded since the release of 14.1. No update of this package means no /etc/shadow.new, etc to deal with hence no change in your password. Upgrading to Slackware 14.2 will be a different matter (new users and groups have been added in 14.2).

In fact, you can safely use the "O" option with "slackpkg new-config", if you have looked closely into the Changelog to make sure that package a/etc has not been updated. If you tinker with another config file (ex: /etc/slackpkg/mirrors), you similarly have to check that the package containing it has not been updated. Otherwise it's preferable to deal manually with this .new config file.

The update of the 3 /etc files mentioned earlier is better managed manually. You can see in Slackware UPGRADE.TXT step 5 that even Patrick Volkerding doesn't want his script to deal automatically with these files (and two others as a matter of fact - see part highlighted in blue below) leaving their update up to the user.
Quote:

5. Fix your config files. Some of the config files in /etc are going to
need your attention. You'll find the new incoming config files on
your system with the ".new" extension. You may need to fill these in
with information from your old config files and then move them over.

Feel brave? You can use this little script to install most of the
.new config files in /etc. If you've made any local changes you'll
need to add them to the newly installed files. Your old config files
will be copied to *.bak. Anyway, it might be an easier starting
point. Here it is:

#!/bin/sh
cd /etc
find . -name "*.new" | while read configfile ; do
if [ ! "$configfile" = "./rc.d/rc.inet1.conf.new" \
-a ! "$configfile" = "./rc.d/rc.local.new" \
-a ! "$configfile" = "./group.new" \
-a ! "$configfile" = "./passwd.new" \
-a ! "$configfile" = "./shadow.new"
]; then
cp -a $(echo $configfile | rev | cut -f 2- -d . | rev) \
$(echo $configfile | rev | cut -f 2- -d . | rev).bak 2> /dev/null
mv $configfile $(echo $configfile | rev | cut -f 2- -d . | rev)
fi
done

You might also wish to move these config files over:

/usr/lib*/man.conf.new
/usr/share/vim/vimrc.new

PROBLEMCHYLD 02-13-2016 09:03 PM

Some more screenshots from the fruits of your labor.
Updated with your script.

http://s7.postimg.org/wg632r3fr/Scre...3_20_39_14.pnghttp://s7.postimg.org/4hbxbw1t3/Scre...3_20_41_03.png
http://s7.postimg.org/cpduwvtpj/Scre...3_20_42_02.pnghttp://s7.postimg.org/koi7ry8tj/Scre...3_20_42_56.png
http://s7.postimg.org/vclyqsisn/Scre...3_20_44_43.pnghttp://s7.postimg.org/jva7d2s6f/Scre...3_20_47_49.png

gegechris99 02-14-2016 03:35 AM

Last version of the installation script
 
1 Attachment(s)
Thanks PROBLEMCHYLD for taking the time/risk to test the script on an actual installation and for reporting back on how it performed.

Most of the credit goes to Niki, the MLED founder who took great pains to provide quality documentation. This script is just an automation of the steps described in the MLED installation guide.

The script might not be bulletproof (for ex: adequate error management is missing) but at least it does the job when the conditions are normal (i.e. no break in internet connection, no change of package location).

It's too bad that I cannot edit my original post to include the latest version of the script. So I attach it to this post (file mledauto.txt is to be renamed mledauto.sh).

At the very least, I will try to add in the script a help section to show how flags MIRROR, MULTILIB, VBOX can be used to customize the installation.

PROBLEMCHYLD 02-14-2016 07:15 AM

Shall we proceed with this enhancement-automation endeavor?

Here are some of the remaining tasks we or you could automate. We should start with the first obstacle

Mirrors

Quote:

# /etc/slackpkg/mirrors
...
# GERMANY (DE)
fxp://fxp.fu-berlin.de/unix/linux/slackware/slackware-14.1/
Here is a link to some of the updated mirrors, http://mirrors.slackware.com/mirrorlist/ we can use as a starting point. Some of the ones in the original slackware have broken links. I always use http://slackbuilds.org/mirror/slackware/ it seems to be one of the fastest and updated.

The script would ask,

What is your location? user would enter (US) or (DE)
The script then shows a list of US mirrors or DE mirrors, or pick one automatically based on the location. It could ping and select the fastest one for you. It would start with http and if a link is broken, it goes to the next http mirror. If all http mirrors are broken, then we use ftp mirrors. We do this until one is found that we can use. After that, the script runs and users can sit back and relax.

hxxp://carroll.cac.psu.edu/pub/linux/distributions/slackware
hxxp://dfw.mirror.rackspace.com/slackware/
hxxp://fxp.gtlib.gatech.edu/pub/slackware/
hxxp://fxp.slackware.com/pub/slackware/
hxxp://lug.mtu.edu/slackware/
hxxp://mirror.lug.udel.edu/pub/slackware/
hxxp://mirror.metrocast.net/slackware/
hxxp://mirror.nexcess.net/slackware/
hxxp://mirrors.kingrst.com/slackware/
hxxp://mirrors.xmission.com/slackware/
hxxp://mirrors1.kernel.org/slackware/
hxxp://mirrors2.kernel.org/slackware/
hxxp://mirrors3.kernel.org/slackware/
hxxp://mirrors4.kernel.org/slackware/
hxxp://reflect.cs.princeton.edu/slackware/
hxxp://slackblog.com/slackware/
hxxp://slackbuilds.org/mirror/slackware/
hxxp://slackware.cs.utah.edu/pub/slackware/
hxxp://slackware.mirrors.tds.net/pub/slackware/
hxxp://taper.alienbase.nl/mirrors/slackware/
fxp://carroll.cac.psu.edu/pub/linux/distributions/slackware
fxp://dfw.mirror.rackspace.com/slackware/
fxp://fxp.gtlib.gatech.edu/pub/slackware
fxp://fxp.lug.udel.edu/pub/slackware/
fxp://fxp.slackware.com/pub/slackware/
fxp://lug.mtu.edu/slackware/
fxp://mirror.nexcess.net/slackware/
fxp://mirrors.xmission.com/slackware/
fxp://mirrors1.kernel.org/slackware/
fxp://mirrors2.kernel.org/slackware/
fxp://mirrors3.kernel.org/slackware/
fxp://mirrors4.kernel.org/slackware/
fxp://slackware.cs.utah.edu/slackware/
fxp://slackware.mirrors.tds.net/pub/slackware
fxp://taper.alienbase.nl/


All times are GMT -5. The time now is 05:21 AM.