Post Slackware upgrade modifications
With all the recent Slackware upgrades, old irritations have come back and finally annoyed me so much I did something about them.
When Slackware is first installed, or certain packages are upgraded, there are two things that irritate me. (Let’s face it, lots of things irritate me in life but these two bug me on a fundamental level).
Midnight Commander is a fine, fine command line visual file handler and I use it all the time. I rely on it. Many years ago in its history, they added a little feature to return the current directory in the system return code. That was fine by me, because it didn’t affect me. But someone decided that everyone really desperately wanted to exit Midnight Commander and then change directory to the last directory you were visiting in Midnight Commander. I don’t. I never do. This is controlled by two scripts in /etc/profile.d called mc.sh and mc.csh. These scripts are exported during shell setup, and when you type mc to start Midnight Commander, you run these scripts. When you exit Midnight Commander, they capture the return code (that last directory name) and they change directory to it.
I don’t want things changing underneath me. If I am in a directory, and I run a program, I want to be in the same directory when I exit. I don’t want to be in a directory on a cdrom and can’t umount it. I don’t want to be moved at all.
Now if you always live in the GUI world and use the GUI tools, you aren’t going to notice this issue. Good for you. I live on the command line and it’s a big source of irritation. It’s easily solved by logging in as root and
chmod ugo-x /etc/profile.d/mc*
And that works fine. Until you upgrade Slackware and some packages get upgraded and suddenly those files are executable again and you end up in some weird directory cursing the people who came up with this stupid idea.
The second irritation for me is with Vim. I’ve spent a lot of time over the last 15 years creating my own .vimrc file that works really nicely for me. It makes me efficient, it suits my workflow. And remember, I work on the command line. I use vim, not gvim. I don’t like working with the graphic stuff, and I don’t like using the mouse when I am editing. I use the mouse for only thing – copy and paste (the Linux way). One thing I do a lot, is have Vim open in one window, and highlight a chunk of text from some other window, maybe some text in a browser, or another Vim on a remote computer, or some text out of the xterm. I highlight that text wherever it may be, go to my Vim session, press i to insert then middle click the mouse there. Normally the highlighted text in the other window is copied into place. That’s the usual behaviour for me.
But not after a Vim upgrade.
After a Vim upgrade, a vimrc file is created in /usr/share/vim, and when you start Vim, it loads this vimrc first, then it loads your local .vimrc file and it uses the amalgam of these. Something in that /usr/share/vim/vimrc alters the behaviour of the copy and paste that I am used to. I don’t know what. I don’t care what. I don’t want someone else’s idea of what a Vim-newbie should be doing with Vim to interfere with my usage of Vim. So when I highlight some text and middle-click in my Vim window and I get something other than my highlighted text, I rage about it and go and delete that damned file /usr/share/vim/vimrc once again.
So I have these two irritations that pop up regularly when you update Slackware regularly. Finally today, I was so irritated when they both came back, that I did something about it.
I created a script called post_upgrade that resides in /root/bin.
#!/bin/bash if [ -x /etc/profile.d/mc.sh ]; then echo Turn off Midnight Commander directory fakery chmod ugo-x /etc/profile.d/mc* fi if [ -e /usr/share/vim/vimrc ]; then echo Removing bad vimrc rm /usr/share/vim/vimrc fi
This will look to see if the mc files have become executable again, or if the vimrc file is back again, and if they are, it will deal with them.
Then I took my update_slack script and call my new script at the end after the updates.
#!/bin/bash # Start updating the system to match -current slackpkg update slackpkg install-new slackpkg upgrade-all slackpkg clean-system # Do post-upgrade processing /root/bin/post_upgrade
I made these changes across all my servers, and now my irritations are automatically handled all the time.
Yes there are security implications. I am aware of them and I check the security regularly.