fix(tools): install locales and fix re-run issues in Ubuntu setup scripts (#7603)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
73652d0a99
commit
81db17e5a7
@@ -18,13 +18,22 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if ! command -v lsb_release >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: lsb_release not found, so the Ubuntu version cannot be checked."
|
||||||
|
echo "Install it with: sudo apt-get install lsb-release"
|
||||||
|
echo "Terminating the script now."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $(lsb_release -rs) != "22.04" ]]; then
|
if [[ $(lsb_release -rs) != "22.04" ]]; then
|
||||||
echo "ERROR: Not running on Ubuntu 22.04!"
|
echo "ERROR: Not running on Ubuntu 22.04!"
|
||||||
echo "Terminating the script now."
|
echo "Terminating the script now."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Setting up package repositories ==="
|
echo "=== Step $((STEP++)): Setting up package repositories. Please provide sudo credentials, when asked ==="
|
||||||
|
# Refresh in case package lists are stale
|
||||||
|
sudo apt-get -y update
|
||||||
sudo apt-get -y install --no-install-recommends software-properties-common gpg gpg-agent wget ca-certificates
|
sudo apt-get -y install --no-install-recommends software-properties-common gpg gpg-agent wget ca-certificates
|
||||||
sudo mkdir -p /etc/apt/keyrings
|
sudo mkdir -p /etc/apt/keyrings
|
||||||
# Set up Kitware repository for newer cmake
|
# Set up Kitware repository for newer cmake
|
||||||
@@ -46,7 +55,7 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
|||||||
read
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Updating Ubuntu package lists. Please provide sudo credentials, when asked ==="
|
echo "=== Step $((STEP++)): Updating Ubuntu package lists for the newly added repositories ==="
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||||
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
|
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
|
||||||
@@ -63,6 +72,7 @@ sudo apt-get -y install --no-install-recommends \
|
|||||||
unzip \
|
unzip \
|
||||||
file \
|
file \
|
||||||
gawk \
|
gawk \
|
||||||
|
m4 \
|
||||||
libsdl2-dev \
|
libsdl2-dev \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
@@ -76,6 +86,7 @@ sudo apt-get -y install --no-install-recommends \
|
|||||||
python-is-python3 \
|
python-is-python3 \
|
||||||
dfu-util \
|
dfu-util \
|
||||||
nodejs \
|
nodejs \
|
||||||
|
locales \
|
||||||
stlink-tools \
|
stlink-tools \
|
||||||
openocd \
|
openocd \
|
||||||
pv
|
pv
|
||||||
@@ -91,6 +102,18 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
|||||||
read
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "=== Step $((STEP++)): Generating locales used by the custom function sorter ==="
|
||||||
|
# cfn_sorter.sh sorts with std::locale, which aborts if a locale is missing
|
||||||
|
sudo locale-gen \
|
||||||
|
zh_CN.UTF-8 cs_CZ.UTF-8 da_DK.UTF-8 de_DE.UTF-8 es_ES.UTF-8 en_US.UTF-8 \
|
||||||
|
fi_FI.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 it_IT.UTF-8 ja_JP.UTF-8 ko_KR.UTF-8 \
|
||||||
|
nl_NL.UTF-8 pl_PL.UTF-8 pt_PT.UTF-8 ru_RU.UTF-8 sv_SE.UTF-8 zh_TW.UTF-8 \
|
||||||
|
uk_UA.UTF-8
|
||||||
|
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||||
|
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
|
||||||
|
read
|
||||||
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Installing Python packages ==="
|
echo "=== Step $((STEP++)): Installing Python packages ==="
|
||||||
sudo python3 -m pip install \
|
sudo python3 -m pip install \
|
||||||
asciitree \
|
asciitree \
|
||||||
@@ -137,6 +160,8 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Moving GNU Arm Embedded Toolchains to /opt ==="
|
echo "=== Step $((STEP++)): Moving GNU Arm Embedded Toolchains to /opt ==="
|
||||||
|
# Remove first: mv into an existing directory nests instead of replacing
|
||||||
|
sudo rm -rf /opt/gcc-arm-none-eabi
|
||||||
sudo mv arm-gnu-toolchain-${GCC_ARM_VERSION}-x86_64-arm-none-eabi /opt/gcc-arm-none-eabi
|
sudo mv arm-gnu-toolchain-${GCC_ARM_VERSION}-x86_64-arm-none-eabi /opt/gcc-arm-none-eabi
|
||||||
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||||
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
|
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
|
||||||
@@ -144,10 +169,12 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Adding GNU Arm Embedded Toolchain and Qt to PATH of current user ==="
|
echo "=== Step $((STEP++)): Adding GNU Arm Embedded Toolchain and Qt to PATH of current user ==="
|
||||||
cat >> ~/.bashrc << EOF
|
# Only append if missing, so re-runs do not duplicate
|
||||||
export PATH="/opt/gcc-arm-none-eabi/bin:\$PATH"
|
touch ~/.bashrc
|
||||||
export PATH="/opt/qt/${QT_VERSION}/gcc_64/bin:\$PATH"
|
GCC_PATH_LINE="export PATH=\"/opt/gcc-arm-none-eabi/bin:\$PATH\""
|
||||||
EOF
|
QT_PATH_LINE="export PATH=\"/opt/qt/${QT_VERSION}/gcc_64/bin:\$PATH\""
|
||||||
|
grep -qxF "${GCC_PATH_LINE}" ~/.bashrc || echo "${GCC_PATH_LINE}" >> ~/.bashrc
|
||||||
|
grep -qxF "${QT_PATH_LINE}" ~/.bashrc || echo "${QT_PATH_LINE}" >> ~/.bashrc
|
||||||
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||||
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
|
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
|
||||||
read
|
read
|
||||||
|
|||||||
@@ -18,13 +18,22 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if ! command -v lsb_release >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: lsb_release not found, so the Ubuntu version cannot be checked."
|
||||||
|
echo "Install it with: sudo apt-get install lsb-release"
|
||||||
|
echo "Terminating the script now."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $(lsb_release -rs) != "24.04" ]]; then
|
if [[ $(lsb_release -rs) != "24.04" ]]; then
|
||||||
echo "ERROR: Not running on Ubuntu 24.04!"
|
echo "ERROR: Not running on Ubuntu 24.04!"
|
||||||
echo "Terminating the script now."
|
echo "Terminating the script now."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Setting up package repositories ==="
|
echo "=== Step $((STEP++)): Setting up package repositories. Please provide sudo credentials, when asked ==="
|
||||||
|
# Refresh in case package lists are stale
|
||||||
|
sudo apt-get -y update
|
||||||
sudo apt-get -y install --no-install-recommends software-properties-common gpg gpg-agent wget ca-certificates
|
sudo apt-get -y install --no-install-recommends software-properties-common gpg gpg-agent wget ca-certificates
|
||||||
sudo mkdir -p /etc/apt/keyrings
|
sudo mkdir -p /etc/apt/keyrings
|
||||||
# Set up Kitware repository for newer cmake
|
# Set up Kitware repository for newer cmake
|
||||||
@@ -42,7 +51,7 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
|||||||
read
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Updating Ubuntu package lists. Please provide sudo credentials, when asked ==="
|
echo "=== Step $((STEP++)): Updating Ubuntu package lists for the newly added repositories ==="
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||||
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
|
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
|
||||||
@@ -59,6 +68,7 @@ sudo apt-get -y install --no-install-recommends \
|
|||||||
unzip \
|
unzip \
|
||||||
file \
|
file \
|
||||||
gawk \
|
gawk \
|
||||||
|
m4 \
|
||||||
libsdl2-dev \
|
libsdl2-dev \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
@@ -72,6 +82,7 @@ sudo apt-get -y install --no-install-recommends \
|
|||||||
python-is-python3 \
|
python-is-python3 \
|
||||||
dfu-util \
|
dfu-util \
|
||||||
nodejs \
|
nodejs \
|
||||||
|
locales \
|
||||||
stlink-tools \
|
stlink-tools \
|
||||||
openocd \
|
openocd \
|
||||||
pv
|
pv
|
||||||
@@ -87,6 +98,18 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
|||||||
read
|
read
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "=== Step $((STEP++)): Generating locales used by the custom function sorter ==="
|
||||||
|
# cfn_sorter.sh sorts with std::locale, which aborts if a locale is missing
|
||||||
|
sudo locale-gen \
|
||||||
|
zh_CN.UTF-8 cs_CZ.UTF-8 da_DK.UTF-8 de_DE.UTF-8 es_ES.UTF-8 en_US.UTF-8 \
|
||||||
|
fi_FI.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 it_IT.UTF-8 ja_JP.UTF-8 ko_KR.UTF-8 \
|
||||||
|
nl_NL.UTF-8 pl_PL.UTF-8 pt_PT.UTF-8 ru_RU.UTF-8 sv_SE.UTF-8 zh_TW.UTF-8 \
|
||||||
|
uk_UA.UTF-8
|
||||||
|
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||||
|
echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop."
|
||||||
|
read
|
||||||
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Installing Python packages ==="
|
echo "=== Step $((STEP++)): Installing Python packages ==="
|
||||||
# Python 3.12+ enforces PEP 668 (managed environment); --break-system-packages allows pip installs outside a venv
|
# Python 3.12+ enforces PEP 668 (managed environment); --break-system-packages allows pip installs outside a venv
|
||||||
sudo python3 -m pip install --break-system-packages --ignore-installed \
|
sudo python3 -m pip install --break-system-packages --ignore-installed \
|
||||||
@@ -134,6 +157,8 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Moving GNU Arm Embedded Toolchains to /opt ==="
|
echo "=== Step $((STEP++)): Moving GNU Arm Embedded Toolchains to /opt ==="
|
||||||
|
# Remove first: mv into an existing directory nests instead of replacing
|
||||||
|
sudo rm -rf /opt/gcc-arm-none-eabi
|
||||||
sudo mv arm-gnu-toolchain-${GCC_ARM_VERSION}-x86_64-arm-none-eabi /opt/gcc-arm-none-eabi
|
sudo mv arm-gnu-toolchain-${GCC_ARM_VERSION}-x86_64-arm-none-eabi /opt/gcc-arm-none-eabi
|
||||||
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||||
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
|
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
|
||||||
@@ -141,10 +166,12 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Step $((STEP++)): Adding GNU Arm Embedded Toolchain and Qt to PATH of current user ==="
|
echo "=== Step $((STEP++)): Adding GNU Arm Embedded Toolchain and Qt to PATH of current user ==="
|
||||||
cat >> ~/.bashrc << EOF
|
# Only append if missing, so re-runs do not duplicate
|
||||||
export PATH="/opt/gcc-arm-none-eabi/bin:\$PATH"
|
touch ~/.bashrc
|
||||||
export PATH="/opt/qt/${QT_VERSION}/gcc_64/bin:\$PATH"
|
GCC_PATH_LINE="export PATH=\"/opt/gcc-arm-none-eabi/bin:\$PATH\""
|
||||||
EOF
|
QT_PATH_LINE="export PATH=\"/opt/qt/${QT_VERSION}/gcc_64/bin:\$PATH\""
|
||||||
|
grep -qxF "${GCC_PATH_LINE}" ~/.bashrc || echo "${GCC_PATH_LINE}" >> ~/.bashrc
|
||||||
|
grep -qxF "${QT_PATH_LINE}" ~/.bashrc || echo "${QT_PATH_LINE}" >> ~/.bashrc
|
||||||
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
if [[ $PAUSEAFTEREACHLINE == "true" ]]; then
|
||||||
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
|
echo "Step finished. Please press Enter to continue or Ctrl+C to stop."
|
||||||
read
|
read
|
||||||
|
|||||||
Reference in New Issue
Block a user