lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 246e5e9 1/3: Make lmi cache a subdirectory of


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 246e5e9 1/3: Make lmi cache a subdirectory of /srv, not of /
Date: Thu, 7 May 2020 10:32:58 -0400 (EDT)

branch: master
commit 246e5e9af42d35f2c8d2203ce216fb361f3561d6
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Make lmi cache a subdirectory of /srv, not of /
    
    FHS-3.0, section 3.1: "Applications must never create or require special
    files or subdirectories in the root directory." Hitherto, for historical
    reasons (on msw, it made as much sense as anything else), cache_for_lmi
    had been a subdirectory of the root directory, except for the hosts of
    chroots, which followed FHS; now FHS is followed everywhere.
    
    Existing installations that have /cache_for_lmi needn't be recreated;
    running
      ln --symbolic --force --no-dereference ../cache_for_lmi /srv
    should suffice.
---
 INSTALL                      | 15 ++++++++-------
 install_centos.sh            | 20 ++++----------------
 install_cygwin.bat           |  8 ++++----
 install_libxml2_libxslt.make |  2 +-
 install_mingw.make           |  2 +-
 install_mingw32.make         |  2 +-
 install_miscellanea.make     |  6 +++---
 install_msw.sh               | 24 ++++++++++++------------
 install_redhat.sh            |  6 +++---
 install_wsl.ps1              |  4 ++--
 install_wx.sh                |  6 +++---
 install_wxpdfdoc.sh          |  6 +++---
 lmi_setup_21.sh              |  4 ++--
 lmi_setup_30.sh              |  8 ++++----
 lmi_setup_43.sh              |  2 +-
 xrc.rnc                      |  2 +-
 16 files changed, 53 insertions(+), 64 deletions(-)

diff --git a/INSTALL b/INSTALL
index 2d39d61..466e244 100644
--- a/INSTALL
+++ b/INSTALL
@@ -39,16 +39,17 @@ Open a "Command Prompt" window, and enable pasting into it:
 Copy and paste the following lines into the "Command Prompt" window:
 
   C:
-  mkdir C:\cache_for_lmi
+  mkdir C:\srv
+  mkdir C:\srv\cache_for_lmi
 
-Save the following files into the 'C:\cache_for_lmi' directory:
+Save the following files into the 'C:\srv\cache_for_lmi' directory:
 
   https://cygwin.com/setup-x86_64.exe
   https://git.savannah.gnu.org/cgit/lmi.git/plain/install_cygwin.bat
 
 Copy and paste the following lines into the "Command prompt" window:
 
-  cd C:\cache_for_lmi
+  cd C:\srv\cache_for_lmi
   install_cygwin
 
 After a few minutes, you should see something like this at the end:
@@ -65,8 +66,8 @@ Open a "Windows PowerShell" window as Administrator:
 
 Copy and paste the following lines into the "Windows PowerShell" window:
 
-  New-Item -ItemType Directory -Force -Path C:\cache_for_lmi
-  Set-Location -Path C:\cache_for_lmi
+  New-Item -ItemType Directory -Force -Path C:\srv\cache_for_lmi
+  Set-Location -Path C:\srv\cache_for_lmi
   Invoke-WebRequest -Uri 
https://git.savannah.gnu.org/cgit/lmi.git/plain/install_wsl.ps1 -OutFile 
install_wsl.ps1 -UseBasicParsing
   Set-ExecutionPolicy Unrestricted
   Enable-WindowsOptionalFeature -Online -FeatureName 
Microsoft-Windows-Subsystem-Linux
@@ -81,7 +82,7 @@ privileges are not required either).
 Open a "Windows PowerShell" window (administrator privileges are not required)
 and execute the installation script:
 
-  C:\cache_for_lmi\install_wsl.ps1
+  C:\srv\cache_for_lmi\install_wsl.ps1
 
 Note: Only Ubuntu 18.04 is supported now because non-Debian-based OS won't 
work,
 as we use apt, Debian and Ubuntu 16.04 uses the i686-w64-mingw32-g++ package of
@@ -101,7 +102,7 @@ Close the "Windows PowerShell" window.
 
 (B) Install lmi
 
-[Experienced users: Make sure 'C:\cache_for_lmi\' contains any files you
+[Experienced users: Make sure 'C:\srv\cache_for_lmi\' contains any files you
 need to download manually due to corporate firewall weirdness.]
 
 Start a Cygwin shell:
diff --git a/install_centos.sh b/install_centos.sh
index 921bde9..ee4c928 100755
--- a/install_centos.sh
+++ b/install_centos.sh
@@ -217,26 +217,14 @@ shell=/bin/zsh
 type=plain
 EOF
 
-# 'cache_for_lmi' is a subdirectory of the root, in a guest used for
-# building lmi; but it is a subdirectory of /srv in a host used for
-# creating a guest for building lmi, because a corporation that owns
-# a host server might not allow a subdirectory of the system root to
-# be created.
-#
-# This centos chroot is a guest of an underlying host, but its purpose
-# is to emulate such a host. Therefore, its 'cache_for_lmi' directory
-# is a subdirectory of its /srv.
-#
-# The same host directory is mounted in the ultimate debian guest here
-# and now, only because that's so readily done.
-
 mkdir -p /srv/cache_for_lmi
 du   -sb /srv/chroot/centos7lmi/srv/cache_for_lmi || echo "Okay."
 mkdir -p /srv/chroot/centos7lmi/srv/cache_for_lmi
 mount --bind /srv/cache_for_lmi /srv/chroot/centos7lmi/srv/cache_for_lmi
-du   -sb /srv/chroot/centos7lmi/srv/chroot/"${CHRTNAME}"/cache_for_lmi || echo 
"Okay."
-mkdir -p /srv/chroot/centos7lmi/srv/chroot/"${CHRTNAME}"/cache_for_lmi
-mount --bind /srv/cache_for_lmi 
/srv/chroot/centos7lmi/srv/chroot/"${CHRTNAME}"/cache_for_lmi
+# Might as well do likewise now for ${CHRTNAME} as well.
+du   -sb /srv/chroot/centos7lmi/srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi || 
echo "Okay."
+mkdir -p /srv/chroot/centos7lmi/srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
+mount --bind /srv/cache_for_lmi 
/srv/chroot/centos7lmi/srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
 
 cat >/srv/chroot/centos7lmi/tmp/setup1.sh <<EOF
 #!/bin/sh
diff --git a/install_cygwin.bat b/install_cygwin.bat
index 79efc07..d949865 100644
--- a/install_cygwin.bat
+++ b/install_cygwin.bat
@@ -27,7 +27,7 @@ IF EXIST C:\cygwin\NUL       GOTO FoundOldInstallation
 IF EXIST C:\cygwin64_lmi\NUL GOTO FoundOldInstallation
 
 C:
-cd C:\cache_for_lmi
+cd C:\srv\cache_for_lmi
 START "Installing Cygwin" /WAIT setup-x86_64 ^
   --wait --quiet-mode ^
   --site http://mirrors.kernel.org/sourceware/cygwin/ ^
@@ -35,8 +35,8 @@ START "Installing Cygwin" /WAIT setup-x86_64 ^
    
"autoconf,automake,bc,bsdtar,curl,dos2unix,doxygen,gdb,git,libtool,make,openssh,patch,pkg-config,rsync,unzip,vim,wget,zip,zsh"
 cd C:\cygwin64_lmi\etc
 echo # >> fstab
-echo C:/opt/lmi             /opt/lmi       lmi_specific binary,user 0 0 >> 
fstab
-echo C:/cache_for_lmi       /cache_for_lmi lmi_specific binary,user 0 0 >> 
fstab
+echo C:/opt/lmi           /opt/lmi           lmi_specific binary,user 0 0 >> 
fstab
+echo C:/srv/cache_for_lmi /srv/cache_for_lmi lmi_specific binary,user 0 0 >> 
fstab
 echo Cygwin installation seems to have succeeded
 GOTO End
 
@@ -45,4 +45,4 @@ echo Cygwin appears already to have been installed
 GOTO End
 
 :End
-cd C:\cache_for_lmi
+cd C:\srv\cache_for_lmi
diff --git a/install_libxml2_libxslt.make b/install_libxml2_libxslt.make
index 085d8d0..288f085 100644
--- a/install_libxml2_libxslt.make
+++ b/install_libxml2_libxslt.make
@@ -46,7 +46,7 @@ mingw_dir     := 
/opt/lmi/${LMI_COMPILER}_${LMI_TRIPLET}/gcc_msw
 prefix        := /opt/lmi/local
 exec_prefix   := $(prefix)/$(LMI_COMPILER)_$(LMI_TRIPLET)
 
-cache_dir     := /cache_for_lmi/downloads
+cache_dir     := /srv/cache_for_lmi/downloads
 
 build_dir     := $(exec_prefix)/xml-ad_hoc
 
diff --git a/install_mingw.make b/install_mingw.make
index ffca17e..83d70b5 100644
--- a/install_mingw.make
+++ b/install_mingw.make
@@ -45,7 +45,7 @@ file_list   = $($(version))
 mingw_dir  := /opt/lmi/${LMI_COMPILER}_${LMI_TRIPLET}/gcc_msw
 prefix     := $(mingw_dir)
 
-cache_dir  := /cache_for_lmi/downloads
+cache_dir  := /srv/cache_for_lmi/downloads
 
 ad_hoc_dir := /opt/lmi/zzz/mingw-ad_hoc/ad_hoc
 
diff --git a/install_mingw32.make b/install_mingw32.make
index 8398cff..342a112 100644
--- a/install_mingw32.make
+++ b/install_mingw32.make
@@ -45,7 +45,7 @@ file_list   = $($(version))
 mingw_dir  := /opt/lmi/${LMI_COMPILER}_${LMI_TRIPLET}/gcc_msw
 prefix     := $(mingw_dir)
 
-cache_dir  := /cache_for_lmi/downloads
+cache_dir  := /srv/cache_for_lmi/downloads
 
 ad_hoc_dir := /opt/lmi/zzz/mingw-ad_hoc/ad_hoc
 
diff --git a/install_miscellanea.make b/install_miscellanea.make
index 3b9c995..81c6eb2 100644
--- a/install_miscellanea.make
+++ b/install_miscellanea.make
@@ -23,7 +23,7 @@
 
 prefix    := /opt/lmi
 
-cache_dir := /cache_for_lmi/downloads
+cache_dir := /srv/cache_for_lmi/downloads
 
 # In the past, it seemed necessary to specify a mirror, e.g.:
 #  mirror := https://easynews.dl.sourceforge.net/sourceforge
@@ -134,8 +134,8 @@ all: boost cgicc jing sample trang xmlwrapp
 #   pushd /tmp
 #   mkdir original
 #   mkdir modified
-#   cd /tmp/original && tar -xjvf /cache_for_lmi/downloads/cgicc-3.1.4.tar.bz2
-#   cd /tmp/modified && tar -xjvf /cache_for_lmi/downloads/cgicc-3.1.4.tar.bz2
+#   cd /tmp/original && tar -xjvf 
/srv/cache_for_lmi/downloads/cgicc-3.1.4.tar.bz2
+#   cd /tmp/modified && tar -xjvf 
/srv/cache_for_lmi/downloads/cgicc-3.1.4.tar.bz2
 # Patch first with '--dry-run' to be sure, then for real:
 #   patch --strip=1 --dry-run </opt/lmi/src/lmi/cgicc-3.1.4.patch
 #   patch --strip=1 </opt/lmi/src/lmi/cgicc-3.1.4.patch
diff --git a/install_msw.sh b/install_msw.sh
index 237c7a6..ebb4c7d 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -155,7 +155,7 @@ then
         sudo apt install -y $packages_list
     fi
 
-    # Mount /opt/lmi and /cache_for_lmi directories.
+    # Mount /opt/lmi and /srv/cache_for_lmi directories.
     # Unfortunately sudo must be used because we don't have permissions to
     # write to /opt and / directories.
     mkdir --parents /mnt/c/opt/lmi/src/lmi
@@ -165,12 +165,12 @@ then
         [ ! -d /opt/lmi ] && sudo mkdir /opt/lmi
         sudo mount --bind /mnt/c/opt/lmi /opt/lmi
     fi
-    mkdir --parents /mnt/c/cache_for_lmi
-    restore_cache_mount=$(mount | grep '/cache_for_lmi')
+    mkdir --parents /mnt/c/srv/cache_for_lmi
+    restore_cache_mount=$(mount | grep '/srv/cache_for_lmi')
     if [ -z "$restore_cache_mount" ]
     then
-        [ ! -d /cache_for_lmi ] && sudo mkdir /cache_for_lmi
-        sudo mount --bind /mnt/c/cache_for_lmi /cache_for_lmi
+        [ ! -d /srv/cache_for_lmi ] && sudo mkdir /srv/cache_for_lmi
+        sudo mount --bind /mnt/c/srv/cache_for_lmi /srv/cache_for_lmi
     fi
 fi
 
@@ -217,23 +217,23 @@ then
     # It seems quite unlikely that anyone who's building lmi would have
     # any other need for mounts with the names used here.
 
-    restore_cache_mount=$(mount --mount-entries | grep '/cache_for_lmi ')
+    restore_cache_mount=$(mount --mount-entries | grep '/srv/cache_for_lmi ')
     [ -z "$restore_cache_mount" ] \
-      || printf '%s\n' "$restore_cache_mount" | grep --silent 
'C:/cache_for_lmi' \
+      || printf '%s\n' "$restore_cache_mount" | grep --silent 
'C:/srv/cache_for_lmi' \
       || printf 'Replacing former cache mount:\n  %s\n' "$restore_cache_mount" 
>/dev/tty
-    mount --force "C:/cache_for_lmi" "/cache_for_lmi"
+    mount --force "C:/srv/cache_for_lmi" "/srv/cache_for_lmi"
 fi
 
-# Downloaded archives are kept in /cache_for_lmi/downloads/ because
+# Downloaded archives are kept in /srv/cache_for_lmi/downloads/ because
 # they are costly to download and some host might be temporarily
 # unavailable.
 
-mkdir --parents /cache_for_lmi/downloads
+mkdir --parents /srv/cache_for_lmi/downloads
 
 mount
 
 md5sum "$0"
-find /cache_for_lmi/downloads -type f -print0 | xargs --null md5sum
+find /srv/cache_for_lmi/downloads -type f -print0 | xargs --null md5sum
 
 make "$coefficiency" --output-sync=recurse -f install_miscellanea.make clobber
 make "$coefficiency" --output-sync=recurse -f install_miscellanea.make
@@ -269,7 +269,7 @@ do
     ./install_wx.sh
     ./install_wxpdfdoc.sh
 
-    find /cache_for_lmi/downloads -type f -print0 | xargs --null md5sum
+    find /srv/cache_for_lmi/downloads -type f -print0 | xargs --null md5sum
 
     # Source this script only for commands that depend upon it.
     . ./set_toolchain.sh
diff --git a/install_redhat.sh b/install_redhat.sh
index 0bdc940..7b7938b 100755
--- a/install_redhat.sh
+++ b/install_redhat.sh
@@ -169,9 +169,9 @@ type=plain
 EOF
 
 mkdir -p /srv/cache_for_lmi
-du   -sb /srv/chroot/"${CHRTNAME}"/cache_for_lmi || echo "Okay."
-mkdir -p /srv/chroot/"${CHRTNAME}"/cache_for_lmi
-mount --bind /srv/cache_for_lmi /srv/chroot/"${CHRTNAME}"/cache_for_lmi
+du   -sb /srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi || echo "Okay."
+mkdir -p /srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
+mount --bind /srv/cache_for_lmi /srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
 
 # ./lmi_setup_10.sh
 # ./lmi_setup_11.sh
diff --git a/install_wsl.ps1 b/install_wsl.ps1
index 7a9a29c..22e0bac 100644
--- a/install_wsl.ps1
+++ b/install_wsl.ps1
@@ -37,13 +37,13 @@ if ((Test-Path -Path $wsl_registry) -And `
 }
 
 # Create the download directory.
-$dir = 'C:\cache_for_lmi\downloads\'
+$dir = 'C:\srv\cache_for_lmi\downloads\'
 If (!(Test-Path -Path $dir)) {
     New-Item -ItemType Directory -Force -Path $dir
 }
 
 # Download the OS distribution.
-$path = 'C:\cache_for_lmi\downloads\Ubuntu_18_04.appx'
+$path = 'C:\srv\cache_for_lmi\downloads\Ubuntu_18_04.appx'
 If (!(Test-Path -Path $path)) {
     Write-Output ('Downloading "Ubuntu 18.04"...')
     $os_uri = 'https://aka.ms/wsl-ubuntu-1804'
diff --git a/install_wx.sh b/install_wx.sh
index bc6be61..a10eb21 100755
--- a/install_wx.sh
+++ b/install_wx.sh
@@ -23,8 +23,8 @@
 
 set -vxe
 
-# A repository is cached in /cache_for_lmi/vcs/, where it can be kept
-# up to date and reused cheaply--whereas cloning it from a remote
+# A repository is cached in /srv/cache_for_lmi/vcs/, where it can be
+# kept up to date and reused cheaply--whereas cloning it from a remote
 # host takes considerable time and bandwidth, and fails if internet
 # connectivity is lost, or the host is temporarily unavailable, or
 # it is blocked by a corporate firewall.
@@ -55,7 +55,7 @@ repo_name="wxWidgets"
 
 # Script commands 
##############################################################
 
-proxy_parent_dir="/cache_for_lmi/vcs"
+proxy_parent_dir="/srv/cache_for_lmi/vcs"
 mkdir --parents "$proxy_parent_dir"
 
 proxy_wx_dir="$proxy_parent_dir"/$repo_name
diff --git a/install_wxpdfdoc.sh b/install_wxpdfdoc.sh
index dfcda22..9f49d7c 100755
--- a/install_wxpdfdoc.sh
+++ b/install_wxpdfdoc.sh
@@ -23,8 +23,8 @@
 
 set -vxe
 
-# A repository is cached in /cache_for_lmi/vcs/, where it can be kept
-# up to date and reused cheaply--whereas cloning it from a remote
+# A repository is cached in /srv/cache_for_lmi/vcs/, where it can be
+# kept up to date and reused cheaply--whereas cloning it from a remote
 # host takes considerable time and bandwidth, and fails if internet
 # connectivity is lost, or the host is temporarily unavailable, or
 # it is blocked by a corporate firewall.
@@ -55,7 +55,7 @@ repo_name="wxpdfdoc"
 
 # Script commands 
##############################################################
 
-proxy_parent_dir="/cache_for_lmi/vcs"
+proxy_parent_dir="/srv/cache_for_lmi/vcs"
 mkdir --parents "$proxy_parent_dir"
 
 proxy_wxpdfdoc_dir="$proxy_parent_dir"/$repo_name
diff --git a/lmi_setup_21.sh b/lmi_setup_21.sh
index 4394650..3946666 100755
--- a/lmi_setup_21.sh
+++ b/lmi_setup_21.sh
@@ -60,8 +60,8 @@ mkdir -p /etc/opt/lmi
 chown "${NORMAL_USER}":"${NORMAL_GROUP}" /etc/opt/lmi
 mkdir -p /var/opt/lmi
 chown "${NORMAL_USER}":"${NORMAL_GROUP}" /var/opt/lmi
-mkdir -p /cache_for_lmi
-chown "${NORMAL_USER}":"${NORMAL_GROUP}" /cache_for_lmi
+mkdir -p /srv/cache_for_lmi
+chown "${NORMAL_USER}":"${NORMAL_GROUP}" /srv/cache_for_lmi
 
 chsh -s /bin/zsh "${NORMAL_USER}"
 
diff --git a/lmi_setup_30.sh b/lmi_setup_30.sh
index 3381da4..53f0cf8 100755
--- a/lmi_setup_30.sh
+++ b/lmi_setup_30.sh
@@ -38,14 +38,14 @@ assert_not_chrooted
 #   sudo chown greg:greg ${dst} &&
 #   cp --dereference --preserve --recursive ${src}/* ${dst}
 #
-# dst=/srv/chroot/"${CHRTNAME}"/cache_for_lmi
+# dst=/srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
 # sudo mkdir ${dst} &&
 #   sudo chown greg:greg ${dst} &&
 #   cp --dereference --preserve --recursive ${src}/* ${dst}
 
 # If cached lmi downloads are available elsewhere, copy them now.
 # Copying cache_for_lmi/downloads/ is an optional step that merely
-# conserves bandwidth. Directory cache_for_lmi/ in a native msw
+# conserves bandwidth. Directory /srv/cache_for_lmi/ in a native msw
 # installation also contains cygwin files, which are not wanted in a
 # chroot. For convenience, add a bare repository of proprietary files
 # to this directory (after making sure it's up to date), e.g.:
@@ -54,10 +54,10 @@ assert_not_chrooted
 #     /srv/chroot/some-prior-chroot/opt/lmi/blessed/ /srv/cache_for_lmi
 # to update the host, and then:
 cp --dereference --preserve --recursive \
-  /srv/cache_for_lmi/* /srv/chroot/${CHRTNAME}/cache_for_lmi/ || true
+  /srv/cache_for_lmi/* /srv/chroot/${CHRTNAME}/srv/cache_for_lmi/ || true
 # Messages like
 #  cp: '/srv/cache_for_lmi/downloads' and
-#    '/srv/chroot/lmi_bullseye_1/cache_for_lmi/downloads'
+#    '/srv/chroot/lmi_bullseye_1/srv/cache_for_lmi/downloads'
 #    are the same file
 # may arise, harmlessly, because of a mount command in an upstream
 # script.
diff --git a/lmi_setup_43.sh b/lmi_setup_43.sh
index dbc0811..db4c9a8 100755
--- a/lmi_setup_43.sh
+++ b/lmi_setup_43.sh
@@ -42,7 +42,7 @@ git remote set-url --push origin 
address@hidden:/srv/git/lmi.git
 # First, copy "blessed" repository (here, 'cp' is sufficient: this
 # bare repository has no references that need to be resolved):
 cd /opt/lmi || { printf 'failed: cd\n'; exit 3; }
-cp --dereference --preserve --recursive /cache_for_lmi/blessed .
+cp --dereference --preserve --recursive /srv/cache_for_lmi/blessed .
 # Then create a working copy by cloning the bare repository...
 git clone -b master file:///opt/lmi/blessed/proprietary
 # ...and verify it:
diff --git a/xrc.rnc b/xrc.rnc
index 72477b0..eb898be 100644
--- a/xrc.rnc
+++ b/xrc.rnc
@@ -25,7 +25,7 @@
 default namespace     = "http://www.wxwidgets.org/wxxrc";
         namespace xrc = "http://www.wxwidgets.org/wxxrc";
 
-include "/cache_for_lmi/vcs/wxWidgets/misc/schema/xrc_schema.rnc"
+include "/srv/cache_for_lmi/vcs/wxWidgets/misc/schema/xrc_schema.rnc"
     {
     customClasses = InputSequenceEntry | RoundingButtons
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]