[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master ad3d008 07/12: Simplify vim and zsh configura
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master ad3d008 07/12: Simplify vim and zsh configuration |
Date: |
Thu, 11 Jun 2020 20:58:33 -0400 (EDT) |
branch: master
commit ad3d0084bdb8bda27a66312d3657d469e2061663
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Simplify vim and zsh configuration
Rewrote 'lmi_setup_25.sh' to configure vim and zsh for the current user
only. Updated callers to invoke it for root and for normal user.
---
lmi_setup_01.sh | 2 +-
lmi_setup_01c.sh | 2 ++
lmi_setup_01r.sh | 1 +
lmi_setup_25.sh | 26 +++++++-------------------
4 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/lmi_setup_01.sh b/lmi_setup_01.sh
index 47306fd..e7dc84f 100755
--- a/lmi_setup_01.sh
+++ b/lmi_setup_01.sh
@@ -44,8 +44,8 @@ schroot --chroot=${CHRTNAME} --user=root
--directory=/tmp ./lmi_setu
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_21.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_24.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_25.sh
+schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_25.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_29.sh
-
# On a particular corporate server, root is not a sudoer.
if sudo -l true; then
sudo --user="${NORMAL_USER}"
./lmi_setup_30.sh
diff --git a/lmi_setup_01c.sh b/lmi_setup_01c.sh
index 7f852be..03ed5a4 100755
--- a/lmi_setup_01c.sh
+++ b/lmi_setup_01c.sh
@@ -37,6 +37,7 @@ assert_not_chrooted
./lmi_setup_24c.sh
./lmi_setup_25.sh
+su "${NORMAL_USER}" ./lmi_setup_25.sh
cp -a /tmp/schroot_env /srv/chroot/"${CHRTNAME}"/tmp
cp -a lmi_setup_*.sh /srv/chroot/"${CHRTNAME}"/tmp
@@ -49,6 +50,7 @@ schroot --chroot=${CHRTNAME} --user=root
--directory=/tmp ./lmi_setu
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_21.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_24.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_25.sh
+schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_25.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_29.sh
# On a particular corporate server, root is not a sudoer.
if sudo -l true; then
diff --git a/lmi_setup_01r.sh b/lmi_setup_01r.sh
index ef4a90c..d51c5ad 100755
--- a/lmi_setup_01r.sh
+++ b/lmi_setup_01r.sh
@@ -47,6 +47,7 @@ schroot --chroot=${CHRTNAME} --user=root
--directory=/tmp ./lmi_setu
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_21.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_24.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_25.sh
+schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_25.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_29.sh
# On a particular corporate server, root is not a sudoer.
if sudo -l true; then
diff --git a/lmi_setup_25.sh b/lmi_setup_25.sh
index 3c02b4c..1a6291f 100755
--- a/lmi_setup_25.sh
+++ b/lmi_setup_25.sh
@@ -26,38 +26,26 @@
set -evx
-assert_su
+# doesn't matter whether superuser or not
# doesn't matter whether chrooted or not
-# Configure zsh, for root and normal users.
+# Configure zsh.
cp -a .zshrc ~
-cp -a ~/.zshrc /home/"${NORMAL_USER}"/.zshrc
-chown "${NORMAL_USER}":"${NORMAL_GROUP}" /home/"${NORMAL_USER}"/.zshrc
# Configure vim. Rather than trying to split its contents between
# '~/.vimrc' and '/etc/vim/vimrc.local', use '~/.vimrc' for all
-# customizations and copy that file for the normal user too.
+# customizations, and copy that file for each user.
cp -a .vimrc ~
-cp -a ~/.vimrc /home/"${NORMAL_USER}"/.vimrc
-chown "${NORMAL_USER}":"${NORMAL_GROUP}" /home/"${NORMAL_USER}"/.vimrc
# Without this, 'zg' gives an error message; with it, vim creates a
# spellfile the first time 'zg' is used, if none already exists.
-mkdir ~/.vim
-mkdir /home/"${NORMAL_USER}"/.vim
-chown "${NORMAL_USER}":"${NORMAL_GROUP}" /home/"${NORMAL_USER}"/.vim
-# It's a much better idea to install a mature spellfile:
-mkdir ~/.vim/spell
+# But it's a much better idea to install a mature spellfile and
+# (imperatively) run 'mkspell':
+mkdir -p ~/.vim/spell
cp -a en.utf-8.add ~/.vim/spell/en.utf-8.add
-mkdir /home/"${NORMAL_USER}"/.vim/spell
-chown "${NORMAL_USER}":"${NORMAL_GROUP}" /home/"${NORMAL_USER}"/.vim/spell
-cp -a ~/.vim/spell/en.utf-8.add /home/"${NORMAL_USER}"/.vim/spell/en.utf-8.add
-chown "${NORMAL_USER}":"${NORMAL_GROUP}"
/home/"${NORMAL_USER}"/.vim/spell/en.utf-8.add
-# and then (imperatively) run this command:
vim -es -c ':mkspell! ~/.vim/spell/en.utf-8.add' -c ':q'
-# which will be repeated later for the normal user.
stamp=$(date -u +'%Y%m%dT%H%M%SZ')
-echo "$stamp $0: Configured zsh and vim." | tee /dev/tty
+echo "$stamp $0: Configured zsh and vim for user '$(whoami)'." | tee /dev/tty
- [lmi-commits] [lmi] master c7016ba 05/12: Add all groups before adding any user, (continued)
- [lmi-commits] [lmi] master c7016ba 05/12: Add all groups before adding any user, Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master 6e50a5d 02/12: Create a root-owned file in root's $HOME, not someone else's, Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master 6a0b050 06/12: Refactor to make multi-user configuration easier, Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master a75ef22 04/12: Extract blocks into sub-scripts #24, Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master 8bf7f0e 03/12: Extract block into sub-script #29, Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master 0331fca 12/12: Configure 'wine' for each user, Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master 4dcd8ee 08/12: Restrict permissions to 644 for home-directory files, Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master 9ef51ab 09/12: Configure all users, Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master 0d823ab 11/12: Merge 'lmi_setup_41.sh' into 'lmi_setup_40.sh', Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master bd371a2 10/12: Move git configuration, Greg Chicares, 2020/06/11
- [lmi-commits] [lmi] master ad3d008 07/12: Simplify vim and zsh configuration,
Greg Chicares <=