Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
132 Views

Automatic script to install Midnight Commander (MC) LOCALLY

Usually, one of the first command to invoke on just installed Lunux is `apt install mc`. Unfortunately, it is not work on devcloud virtual machine, but you can easy install it locally for user by script attached to this post.

After execute the script, you have to exit from console and enter to it to make some paths actual.

Script:

#!/bin/bash

# ---------------------------------------
install_local_lib(){
apt download $1
LIB_UNPACK_DEB=`ls | grep "$1"|grep '.deb'`
dpkg -x $LIB_UNPACK_DEB $1
cp -f $1/usr/lib/x86_64-linux-gnu/* $HOME/.local/lib/
rm -rf $LIB_UNPACK_DEB $1
}
# ---------------------------------------
if [[ -z `cat $HOME/.bash_profile|grep 'var_add_path()'` ]]; then
cat << 'EOF' >> $HOME/.bash_profile
# =====================================================
function var_add_path(){
# Use var_add_path "VAR" "/path/to/smth" "s|e"
# s - at the beginning; e - at the end
# echo "Adding $2 to $1 at the <start|end> $3"
  tmp_var=$1
  if [ -d "$2" ]; then
    if [[ ":${!tmp_var}:" != *":$2:"* ]]; then
      # For non-empty, only add if not already there
      if [[ "$3" == "s" ]]; then
    [[ -z "${!tmp_var}" ]] && export $1=$2 || export $1=$2:${!tmp_var}
      else
    [[ -z "${!tmp_var}" ]] && export $1=$2 || export $1=${!tmp_var}:$2
      fi
    fi
  fi
}
# =====================================================
var_add_path "PATH" "$HOME/.local/bin" "s"
var_add_path "PATH" "$HOME/bin" "s"
var_add_path "PATH" "/bin" "e"
var_add_path "LD_LIBRARY_PATH" "$HOME/.local/lib" "e"

EOF
fi

if [[ -z `cat $HOME/.bash_profile|grep 'export MC_DATADIR='` ]]; then
cat << 'EOF' >> $HOME/.bash_profile
export MC_DATADIR=$HOME/.local/share/mc
EOF
fi

[[ ! -d $HOME/src ]] && mkdir $HOME/src
cd $HOME/src

install_local_lib "libssh2-1"
# install_local_lib "libslang2"
# install_local_lib "libgpm2"
# install_local_lib "libglib2.0-0"
# install_local_lib "libext2fs2"
# install_local_lib "libc6"

apt download mc
MC_DIST_DEB=`ls | grep 'mc'|grep '.deb'`
dpkg -x $MC_DIST_DEB mc
sed -i 's,\/usr\/lib\/mc\/ext.d,~\/.local\/lib\/mc\/ext.d,' mc/etc/mc/mc.ext
cp -rf mc/etc/mc $HOME/.config/
cp -f  mc/etc/mc/sfs.ini $HOME/.local/share/mc/
cp -rf mc/usr/bin $HOME/
cp -rf mc/usr/lib $HOME/.local/
cp -rf mc/usr/share $HOME/.local/

apt download mc-data
MCD_DIST_DEB=`ls | grep "mc-data"|grep '.deb'`
dpkg -x $MCD_DIST_DEB mc-data
cp -rf mc-data/usr/share $HOME/.local/
[[ ! -d $HOME/.config/mc/mcedit ]] && mkdir $HOME/.config/mc/mcedit
cp -rf mc-data/usr/share/mc/syntax/*  $HOME/.config/mc/mcedit/

cat << 'EOF' > $HOME/.selected_editor
# Generated by /usr/bin/select-editor
SELECTED_EDITOR="$HOME/bin/mcedit"
EOF


rm -rf $MC_DIST_DEB $MCD_DIST_DEB mc mc-data

 

Tags (1)
0 Kudos
7 Replies
Highlighted
Moderator
132 Views

Dear Tyurin,

Thanks for the information, we had informed concerned team about this.

 

0 Kudos
Highlighted
Moderator
132 Views

Dear Tyurin,

Intel DevCloud® is a shared environment which comes with pre-installed validated Intel® oneAPI software and complimentary packages. As a policy we do not install custom (open source or 3rd party licensed) software to the environment and recommend that you explore available and equivalent oneAPI SW tools or components.  You may be able to install software locally in your user folder.

 

 

0 Kudos
Highlighted
New Contributor I
132 Views

Adweidh_Intel (Intel) wrote:

Dear Tyurin,

Intel DevCloud® is a shared environment which comes with pre-installed validated Intel® oneAPI software and complimentary packages. As a policy we do not install custom (open source or 3rd party licensed) software to the environment and recommend that you explore available and equivalent oneAPI SW tools or components.  You may be able to install software locally in your user folder.

Thanks for point.

This script is designed exactly for user local installation of MC.
I changed the title to clarify this.

0 Kudos
Highlighted
Moderator
132 Views

Dear Tyurin,

Thanks for updating the title, this will be really helpful for the users.

Shall we close this thread ?

0 Kudos
Highlighted
New Contributor I
132 Views

Yes, you can close the thread.

0 Kudos
Highlighted
132 Views

please help I am unable to post an issue again I am getting the below errors

 

The form has become outdated. Copy any unsaved work in the form below and then reload this page.

 

please how can I solve that

0 Kudos
Highlighted
Moderator
132 Views

Dear Tyurin,

We are closing this thread, in case of any issues kindly raise a new thread.

Dear Tchouanga,

We have informed this issue with concerned team, there will be a quick fix on same.

0 Kudos