Skip to content

Instantly share code, notes, and snippets.

@ClayRabbit
Last active October 24, 2024 16:09
Show Gist options
  • Save ClayRabbit/ae1f2cd19ba3db4dbbdeec777396505e to your computer and use it in GitHub Desktop.
Save ClayRabbit/ae1f2cd19ba3db4dbbdeec777396505e to your computer and use it in GitHub Desktop.
install Midnight Commander locally (without root)
#!/bin/sh
# install Midnight Commander locally (without root)
wget https://download.opensuse.org/repositories/home:/laurentwandrebeck:/mc/CentOS_7/x86_64/mc-4.8.27-1.1.x86_64.rpm
(mkdir rpm && cd rpm/ && rpm2cpio ../mc-4.8.27-1.1.x86_64.rpm | cpio -idv)
echo "export MC_DATADIR=~/rpm/usr/share/mc" >> .bashrc
echo "alias mc=~/rpm/usr/bin/mc" >> .bashrc
cp -rp rpm/usr/libexec/mc/* .local/share/mc/
cp -rp rpm/etc/mc/* rpm/usr/share/mc/ && sed -i 's#/usr/libexec/mc/ext.d/#~/rpm/usr/libexec/mc/ext.d/#' rpm/usr/share/mc/mc.ext
mkdir -p .config/mc/mcedit && cp rpm/usr/share/mc/syntax/Syntax .config/mc/mcedit/
chmod -R 755 rpm/usr/bin/* rpm/usr/libexec/mc/ext.d/*.sh
[ -e ".profile" ] || cat << EOF >> ".profile"
if [ -n "\$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "\$HOME/.bashrc" ]; then
. "\$HOME/.bashrc"
fi
fi
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment