aboutsummaryrefslogtreecommitdiff
path: root/reproduce/software/shell
diff options
context:
space:
mode:
Diffstat (limited to 'reproduce/software/shell')
-rwxr-xr-xreproduce/software/shell/bashrc.sh21
-rwxr-xr-xreproduce/software/shell/configure.sh167
2 files changed, 148 insertions, 40 deletions
diff --git a/reproduce/software/shell/bashrc.sh b/reproduce/software/shell/bashrc.sh
index b2a151f..69bbba6 100755
--- a/reproduce/software/shell/bashrc.sh
+++ b/reproduce/software/shell/bashrc.sh
@@ -31,15 +31,12 @@
#
# Copyright (C) 2019-2020 Mohammad Akhlaghi <mohammad@akhlaghi.org>
#
-# This script is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation, either version 3 of the License, or (at your
-# option) any later version.
-#
-# This script is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-# Public License for more details.
-#
-# A copy of the GNU General Public License is available at
-# <http://www.gnu.org/licenses/>.
+# This script is part of Maneage. Maneage is free software: you can
+# redistribute it and/or modify it under the terms of the GNU General
+# Public License as published by the Free Software Foundation, either
+# version 3 of the License, or (at your option) any later version.
+#
+# Maneage is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details. See <http://www.gnu.org/licenses/>.
diff --git a/reproduce/software/shell/configure.sh b/reproduce/software/shell/configure.sh
index dc93d80..71b07cc 100755
--- a/reproduce/software/shell/configure.sh
+++ b/reproduce/software/shell/configure.sh
@@ -4,18 +4,18 @@
#
# Copyright (C) 2018-2020 Mohammad Akhlaghi <mohammad@akhlaghi.org>
#
-# This script is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation, either version 3 of the License, or (at your
-# option) any later version.
+# This script is part of Maneage. Maneage is free software: you can
+# redistribute it and/or modify it under the terms of the GNU General
+# Public License as published by the Free Software Foundation, either
+# version 3 of the License, or (at your option) any later version.
#
-# This script is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-# Public License for more details.
-#
-# A copy of the GNU General Public License is available at
-# <http://www.gnu.org/licenses/>.
+# Maneage is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details. See <http://www.gnu.org/licenses/>.
+
+
+
# Script settings
@@ -93,6 +93,64 @@ absolute_dir ()
+# Check file permission handling (POSIX-compatibility)
+# ----------------------------------------------------
+#
+# Check if a `given' directory handles permissions as expected.
+#
+# This is to prevent a known bug in the NTFS filesystem that prevents
+# proper installation of Perl, and probably some other packages. This
+# function receives the directory as an argument and then, creates a dummy
+# file, and examines whether the given directory handles the file
+# permissions as expected.
+#
+# Returns `0' if everything is fine, and `255' otherwise. Choosing `0' is
+# to mimic the `$ echo $?' behavior, while choosing `255' is to prevent
+# misunderstanding 0 and 1 as true and false.
+#
+# ===== CAUTION! ===== #
+#
+# Since there is a `set -e' before running this function, the whole script
+# stops and exits IF the `check_permission' (or any other function) returns
+# anything OTHER than `0'! So, only use this function as a test. Here's a
+# minimal example:
+#
+# if $(check_permission $some_directory) ; then
+# echo "yay"; else "nay";
+# fi ;
+check_permission ()
+{
+ # Make a `junk' file, activate its executable flag and record its
+ # permissions generally.
+ local junkfile=$1/check_permission_tmp_file
+ rm -f $junkfile
+ echo "Don't let my short life go to waste" > $junkfile
+ chmod +x $junkfile
+ local perm_before=$(ls -l $junkfile | awk '{print $1}')
+
+ # Now, remove the executable flag and record the permissions.
+ chmod -x $junkfile
+ local perm_after=$(ls -l $junkfile | awk '{print $1}')
+
+ # Clean up before leaving the function
+ rm -f $junkfile
+
+ # If the permissions are equal, the filesystem doesn't allow
+ # permissions.
+ if [ $perm_before = $perm_after ]; then
+ # Setting permission FAILED
+ return 1
+ else
+ # Setting permission SUCCESSFUL
+ return 0
+ fi
+}
+
+
+
+
+
+
# Check for C/C++ compilers
# -------------------------
#
@@ -241,7 +299,7 @@ rm -f $testprog $testsource
# See if the C compiler can build static libraries
# ------------------------------------------------
-
+#
# We are manually only working with shared libraries: because some
# high-level programs like Wget and cURL need dynamic linking and if we
# build the libraries statically, our own builds will be ignored and these
@@ -258,6 +316,44 @@ static_build=no
+# Check for GNU gettext
+# ---------------------
+#
+# Some of the basic sofware need GNU gettext which we don't yet install.
+has_gettext=0
+if type msgfmt > /dev/null 2>/dev/null; then has_gettext=1; fi
+if [ $has_gettext = 0 ]; then
+ cat <<EOF
+______________________________________________________
+!!!!!!! GNU gettext NOT FOUND !!!!!!!
+
+Some of the core programs in Maneage require a running GNU gettext on the
+host. Unfortuantely we haven't had the time yet to include its installation
+in Maneage, but it is defined as task #15616 so we don't forget. Generally,
+GNU gettext is already available on many systems, so it hasn't been
+reported too commonly. But please consider helping in this if you have
+time and interest.
+
+Until we include gettext's installation in Maneage, please use your package
+manager to install GNU gettext, then re-run the configuration to
+continue. Here are the relevant commands on some common GNU/Linux
+distributions (you'll only need one of them, or a similar command, if you
+use another package manager):
+
+ apt install gettext
+ yum install gettext
+ pacman -S gettext
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+EOF
+ exit 1
+fi
+
+
+
+
+
# If we are on a Mac OS system
# ----------------------------
#
@@ -287,7 +383,6 @@ ______________________________________________________
EOF
sleep 5
else
- host_cc=0
on_mac_os=no
fi
@@ -653,21 +748,20 @@ EOF
bdir=$(absolute_dir $build_dir)
rm -rf $build_dir/$junkname
else
- echo " -- Can't write in '$build_dir'"; echo
+ echo " ** Can't write in '$build_dir'"; echo
fi
else
if mkdir $build_dir 2> /dev/null; then
instring="the newly created"
bdir=$(absolute_dir $build_dir)
else
- echo " -- Can't create '$build_dir'"; echo
+ echo " ** Can't create '$build_dir'"; echo
fi
fi
# If its given, make sure it isn't a subdirectory of the source
# directory.
if ! [ x"$bdir" = x ]; then
- echo "Given build directory: $bdir"
if echo "$bdir/" \
| grep '^'$currentdir 2> /dev/null > /dev/null; then
@@ -676,17 +770,30 @@ EOF
# Inform the user that this is not acceptable and reset `bdir'.
bdir=
- echo " -- The build-directory cannot be under the source-directory."
- echo " Please specify another build-directory that is outside of the source."
- echo ""
- else
- echo " -- Build directory set to ($instring): '$bdir'"
+ echo " ** The build-directory cannot be under the source-directory."
+ fi
+ fi
+
+ # If everything is fine until now, see if we're able to manipulate
+ # file permissions.
+ if ! [ x"$bdir" = x ]; then
+ if ! $(check_permission $bdir); then
+ bdir=
+ echo " ** File permissions can't be modified in this directory"
fi
fi
- # Reset `build_dir' to blank, so it continues asking when the
- # previous value wasn't usable.
- build_dir=
+ # If the build directory was good, the loop will stop, if not,
+ # reset `build_dir' to blank, so it continues asking for another
+ # directory and let the user know that they must select a new
+ # directory.
+ if [ x$bdir = x ]; then
+ build_dir=
+ echo " ** Please select another directory."
+ echo ""
+ else
+ echo " -- Build directory set to ($instring): '$bdir'"
+ fi
done
fi
@@ -1405,12 +1512,16 @@ cat <<EOF
----------------
The project and its environment are configured with no errors.
-Please run the following command to start.
+To change the configuration later, you can re-run './project configure' or
+manually edit 'reproduce/software/config/LOCAL.conf'. Just be careful with
+the build-directory: its location is hard-coded in the installed software
+so if you change it manually, many of the project's software will crash. If
+you have to use another built-directory, just re-configure a clean project
+there.
+
+Please run the following command to start the project.
(Replace '8' with the number of CPU threads on your system)
$buildcommand
-To change the configuration later, please re-run './project configure', DO
-NOT manually edit the relevant files.
-
EOF