Skip to content

Commit

Permalink
fix(lib_install): Disable file system translation in checkinstall d…
Browse files Browse the repository at this point in the history
…uring dependency installation (fixes #642). (#644)
  • Loading branch information
junhaoliao authored Jan 13, 2025
1 parent 403b3da commit 9d8359a
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 40 deletions.
21 changes: 16 additions & 5 deletions components/core/tools/scripts/lib_install/fmtlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ if [ $installed -eq 0 ] ; then
fi

echo "Checking for elevated privileges..."
privileged_command_prefix=""
install_cmd_args=()
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo echo "Script can elevate privileges."
privileged_command_prefix="${privileged_command_prefix} sudo"
install_cmd_args+=("sudo")
fi

# Get number of cpu cores
Expand Down Expand Up @@ -74,11 +74,22 @@ checkinstall_installed=$?
set -e

# Install
install_command_prefix="${privileged_command_prefix}"
if [ $checkinstall_installed -eq 0 ] ; then
install_command_prefix="${install_command_prefix} checkinstall --pkgname '${package_name}' --pkgversion '${version}' --provides '${package_name}' --nodoc -y --pakdir \"${deb_output_dir}\""
install_cmd_args+=(
checkinstall
--default
--fstrans=no
--nodoc
--pkgname "${package_name}"
--pkgversion "${version}"
--provides "${package_name}"
--pakdir "${deb_output_dir}"
)
fi
${install_command_prefix} make install
install_cmd_args+=(
make install
)
"${install_cmd_args[@]}"

# Clean up
rm -rf $temp_dir
21 changes: 16 additions & 5 deletions components/core/tools/scripts/lib_install/libarchive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ if [ $installed -eq 0 ] ; then
fi

echo "Checking for elevated privileges..."
privileged_command_prefix=""
install_cmd_args=()
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo echo "Script can elevate privileges."
privileged_command_prefix="${privileged_command_prefix} sudo"
install_cmd_args+=("sudo")
fi

# Get number of cpu cores
Expand Down Expand Up @@ -74,11 +74,22 @@ checkinstall_installed=$?
set -e

# Install
install_command_prefix="${privileged_command_prefix}"
if [ $checkinstall_installed -eq 0 ] ; then
install_command_prefix="${install_command_prefix} checkinstall --pkgname '${package_name}' --pkgversion '${version}' --provides '${package_name}' --nodoc -y --pakdir \"${deb_output_dir}\""
install_cmd_args+=(
checkinstall
--default
--fstrans=no
--nodoc
--pkgname "${package_name}"
--pkgversion "${version}"
--provides "${package_name}"
--pakdir "${deb_output_dir}"
)
fi
${install_command_prefix} make install
install_cmd_args+=(
make install
)
"${install_cmd_args[@]}"

# Clean up
rm -rf $temp_dir
42 changes: 40 additions & 2 deletions components/core/tools/scripts/lib_install/liblzma.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,22 @@ if [[ "$#" -gt 1 ]] ; then
fi
fi

# Note: we won't check if the package already exists
# Check if already installed
set +e
dpkg -l "${package_name}" | grep "${version}"
installed=$?
set -e
if [ $installed -eq 0 ] ; then
# Nothing to do
exit
fi

echo "Checking for elevated privileges..."
install_cmd_args=()
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo echo "Script can elevate privileges."
install_cmd_args+=("sudo")
fi

# Get number of cpu cores
num_cpus=$(grep -c ^processor /proc/cpuinfo)
Expand All @@ -60,7 +75,30 @@ mkdir build
cd build
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE ../
make -j${num_cpus}
make install liblzma

# Check if checkinstall is installed
set +e
command -v checkinstall
checkinstall_installed=$?
set -e

# Install
if [ $checkinstall_installed -eq 0 ] ; then
install_cmd_args+=(
checkinstall
--default
--fstrans=no
--nodoc
--pkgname "${package_name}"
--pkgversion "${version}"
--provides "${package_name}"
--pakdir "${deb_output_dir}"
)
fi
install_cmd_args+=(
make install
)
"${install_cmd_args[@]}"

# Clean up
rm -rf $temp_dir
21 changes: 16 additions & 5 deletions components/core/tools/scripts/lib_install/lz4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ if [ $installed -eq 0 ] ; then
fi

echo "Checking for elevated privileges..."
privileged_command_prefix=""
install_cmd_args=()
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo echo "Script can elevate privileges."
privileged_command_prefix="${privileged_command_prefix} sudo"
install_cmd_args+=("sudo")
fi

# Get number of cpu cores
Expand Down Expand Up @@ -71,11 +71,22 @@ checkinstall_installed=$?
set -e

# Install
install_command_prefix="${privileged_command_prefix}"
if [ $checkinstall_installed -eq 0 ] ; then
install_command_prefix="${install_command_prefix} checkinstall --pkgname '${package_name}' --pkgversion '${version}' --provides '${package_name}' --nodoc -y --pakdir \"${deb_output_dir}\""
install_cmd_args+=(
checkinstall
--default
--fstrans=no
--nodoc
--pkgname "${package_name}"
--pkgversion "${version}"
--provides "${package_name}"
--pakdir "${deb_output_dir}"
)
fi
${install_command_prefix} make install
install_cmd_args+=(
make install
)
"${install_cmd_args[@]}"

# Clean up
rm -rf $temp_dir
24 changes: 19 additions & 5 deletions components/core/tools/scripts/lib_install/mariadb-connector-c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ if [ $installed -eq 0 ] ; then
fi

echo "Checking for elevated privileges..."
privileged_command_prefix=""
install_cmd_args=()
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo echo "Script can elevate privileges."
privileged_command_prefix="${privileged_command_prefix} sudo"
privileged_command_prefix="sudo"
install_cmd_args+=(${privileged_command_prefix})
fi

# Get OS version
Expand Down Expand Up @@ -77,11 +78,24 @@ set -e
install_dir=/usr/local
${privileged_command_prefix} mkdir -p ${install_dir}

install_command_prefix="${privileged_command_prefix}"
if [ $checkinstall_installed -eq 0 ] ; then
install_command_prefix="${install_command_prefix} checkinstall --pkgname '${package_name}' --pkgversion '${version}' --provides '${package_name}' --nodoc -y --pakdir \"${deb_output_dir}\""
install_cmd_args+=(
checkinstall
--default
--fstrans=no
--nodoc
--pkgname "${package_name}"
--pkgversion "${version}"
--provides "${package_name}"
--pakdir "${deb_output_dir}"
)
fi
${install_command_prefix} rsync -a . ${install_dir}/
install_cmd_args+=(
rsync
-a .
"${install_dir}/"
)
"${install_cmd_args[@]}"

# Update ld cache
${privileged_command_prefix} ldconfig ${install_dir}/lib/mariadb
Expand Down
5 changes: 3 additions & 2 deletions components/core/tools/scripts/lib_install/mongocxx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ set -e
if [ $checkinstall_installed -eq 0 ] ; then
install_cmd_args+=(
checkinstall
--default
--fstrans=no
--nodoc
--pkgname "${package_name}"
--pkgversion "${version}"
--provides "${package_name}"
--nodoc
-y
--pakdir "${deb_output_dir}"
)
fi
Expand Down
23 changes: 18 additions & 5 deletions components/core/tools/scripts/lib_install/msgpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ if [ $installed -eq 0 ] ; then
fi

echo "Checking for elevated privileges..."
privileged_command_prefix=""
install_cmd_args=()
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo echo "Script can elevate privileges."
privileged_command_prefix="${privileged_command_prefix} sudo"
install_cmd_args+=("sudo")
fi

# Download
Expand All @@ -66,11 +66,24 @@ checkinstall_installed=$?
set -e

# Install
install_command_prefix="${privileged_command_prefix}"
if [ $checkinstall_installed -eq 0 ] ; then
install_command_prefix="${install_command_prefix} checkinstall --pkgname '${package_name}' --pkgversion '${version}' --provides '${package_name}' --nodoc -y --pakdir \"${deb_output_dir}\""
install_cmd_args+=(
checkinstall
--default
--fstrans=no
--nodoc
--pkgname "${package_name}"
--pkgversion "${version}"
--provides "${package_name}"
--pakdir "${deb_output_dir}"
)
fi
${install_command_prefix} cmake --build . --target install
install_cmd_args+=(
cmake
--build .
--target install
)
"${install_cmd_args[@]}"

# Clean up
rm -rf $temp_dir
22 changes: 16 additions & 6 deletions components/core/tools/scripts/lib_install/spdlog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ if [ $installed -eq 0 ] ; then
fi

echo "Checking for elevated privileges..."
privileged_command_prefix=""
install_cmd_args=()
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo echo "Script can elevate privileges."
privileged_command_prefix="${privileged_command_prefix} sudo"
install_cmd_args+=("sudo")
fi

# Get number of cpu cores
Expand Down Expand Up @@ -81,12 +81,22 @@ checkinstall_installed=$?
set -e

# Install
install_command_prefix="${privileged_command_prefix}"
if [ $checkinstall_installed -eq 0 ] ; then
# NOTE: We use "1:${version}" to override the version installed by Ubuntu 18.04
install_command_prefix="${install_command_prefix} checkinstall --pkgname '${package_name}' --pkgversion '1:${version}' --provides '${package_name}' --nodoc -y --pakdir \"${deb_output_dir}\""
install_cmd_args+=(
checkinstall
--default
--fstrans=no
--nodoc
--pkgname "${package_name}"
--pkgversion "${version}"
--provides "${package_name}"
--pakdir "${deb_output_dir}"
)
fi
${install_command_prefix} make install
install_cmd_args+=(
make install
)
"${install_cmd_args[@]}"

# Clean up
rm -rf $temp_dir
21 changes: 16 additions & 5 deletions components/core/tools/scripts/lib_install/zstandard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ if [ $installed -eq 0 ] ; then
fi

echo "Checking for elevated privileges..."
privileged_command_prefix=""
install_cmd_args=()
if [ ${EUID:-$(id -u)} -ne 0 ] ; then
sudo echo "Script can elevate privileges."
privileged_command_prefix="${privileged_command_prefix} sudo"
install_cmd_args+=("sudo")
fi

# Get number of cpu cores
Expand Down Expand Up @@ -74,11 +74,22 @@ checkinstall_installed=$?
set -e

# Install
install_command_prefix="${privileged_command_prefix}"
if [ $checkinstall_installed -eq 0 ] ; then
install_command_prefix="${install_command_prefix} checkinstall --pkgname '${package_name}' --pkgversion '${version}' --provides '${package_name}' --nodoc -y --pakdir \"${deb_output_dir}\""
install_cmd_args+=(
checkinstall
--default
--fstrans=no
--nodoc
--pkgname "${package_name}"
--pkgversion "${version}"
--provides "${package_name}"
--pakdir "${deb_output_dir}"
)
fi
${install_command_prefix} make install
install_cmd_args+=(
make install
)
"${install_cmd_args[@]}"

# Clean up
rm -rf $temp_dir

0 comments on commit 9d8359a

Please sign in to comment.