tarantool / tarantool/installer.sh

Fix installer.sh default values

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
0
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Привет
Я тут полез читать https://tarantool.io/installer.sh

Заинтересовал вот этот кусок
detect_ver ()
{
if [ -z "${VER:-2.5}" ]; then
ver=$tarantool_default_version
else
ver=${VER:-2.5}
fi
ver_repo=$(echo $ver | tr . _)
}

[ -z string — истина, если длина string равна нулю.

В итоге ver=$tarantool_default_version не достижим
Дефолтное значение задается ${VER:-2.5} а не через tarantool_default_version

Прогнал
curl -L https://tarantool.io/installer.sh | VER='' bash -x

...
Detected operating system as ubuntu/focal.

  • detect_ver
  • '[' -z 2.5 ']'
  • ver=2.5
    ++ echo 2.5
    ...

В дополнение, скрипт конфьюзит, когда указываешь несуществующую версию тарантула:

$ curl -L https://tarantool.io/installer.sh | VER=888 bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0   4487      0 --:--:-- --:--:-- --:--:--  4487
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
+ tarantool_default_version=2.5
+ repo_type=live
+ repo_path=
+ repo_only=0
+ os=
+ dist=
10+ [[ 0 -gt 0 ]]
0 10555  100 10555    0     0  20535      0 --:--:-- --:--:-- --:--:-- 20535
+ '[' live = release ']'
+ '[' live '!=' live ']'
+ main
+ detect_os
+ [[ -z '' ]]
+ [[ -z '' ]]
+ '[' -e /etc/centos-release ']'
+ '[' -e /etc/os-release ']'
++ . /etc/os-release
+++ NAME=Ubuntu
+++ VERSION='20.04.2 LTS (Focal Fossa)'
+++ ID=ubuntu
+++ ID_LIKE=debian
+++ PRETTY_NAME='Ubuntu 20.04.2 LTS'
+++ VERSION_ID=20.04
+++ HOME_URL=https://www.ubuntu.com/
+++ SUPPORT_URL=https://help.ubuntu.com/
+++ BUG_REPORT_URL=https://bugs.launchpad.net/ubuntu/
+++ PRIVACY_POLICY_URL=https://www.ubuntu.com/legal/terms-and-policies/privacy-policy
+++ VERSION_CODENAME=focal
+++ UBUNTU_CODENAME=focal
++ echo ubuntu
+ os=ubuntu
++ . /etc/os-release
+++ NAME=Ubuntu
+++ VERSION='20.04.2 LTS (Focal Fossa)'
+++ ID=ubuntu
+++ ID_LIKE=debian
+++ PRETTY_NAME='Ubuntu 20.04.2 LTS'
+++ VERSION_ID=20.04
+++ HOME_URL=https://www.ubuntu.com/
+++ SUPPORT_URL=https://help.ubuntu.com/
+++ BUG_REPORT_URL=https://bugs.launchpad.net/ubuntu/
+++ PRIVACY_POLICY_URL=https://www.ubuntu.com/legal/terms-and-policies/privacy-policy
+++ VERSION_CODENAME=focal
+++ UBUNTU_CODENAME=focal
++ echo debian
+ os_like=debian
+ [[ debian = \u\b\u\n\t\u ]]
+ '[' ubuntu = debian ']'
+ '[' ubuntu = ubuntu ']'
++ . /etc/os-release
+++ NAME=Ubuntu
+++ VERSION='20.04.2 LTS (Focal Fossa)'
+++ ID=ubuntu
+++ ID_LIKE=debian
+++ PRETTY_NAME='Ubuntu 20.04.2 LTS'
+++ VERSION_ID=20.04
+++ HOME_URL=https://www.ubuntu.com/
+++ SUPPORT_URL=https://help.ubuntu.com/
+++ BUG_REPORT_URL=https://bugs.launchpad.net/ubuntu/
+++ PRIVACY_POLICY_URL=https://www.ubuntu.com/legal/terms-and-policies/privacy-policy
+++ VERSION_CODENAME=focal
+++ UBUNTU_CODENAME=focal
++ echo 20.04
+ ver_id=20.04
++ . /etc/os-release
+++ NAME=Ubuntu
+++ VERSION='20.04.2 LTS (Focal Fossa)'
+++ ID=ubuntu
+++ ID_LIKE=debian
+++ PRETTY_NAME='Ubuntu 20.04.2 LTS'
+++ VERSION_ID=20.04
+++ HOME_URL=https://www.ubuntu.com/
+++ SUPPORT_URL=https://help.ubuntu.com/
+++ BUG_REPORT_URL=https://bugs.launchpad.net/ubuntu/
+++ PRIVACY_POLICY_URL=https://www.ubuntu.com/legal/terms-and-policies/privacy-policy
+++ VERSION_CODENAME=focal
+++ UBUNTU_CODENAME=focal
++ echo focal
+ ver_codename=focal
+ '[' '!' -z focal ']'
+ dist=focal
+ [[ -z ubuntu ]]
+ [[ -z focal ]]
+ os=ubuntu
+ dist=focal
+ echo 'Detected operating system as ubuntu/focal.'
Detected operating system as ubuntu/focal.
+ detect_ver
+ '[' -z 888 ']'
+ ver=888
++ echo 888
++ tr . _
+ ver_repo=888
+ '[' ubuntu = centos ']'
+ '[' ubuntu = amzn ']'
+ '[' ubuntu = fedora ']'
+ '[' ubuntu = debian ']'
+ '[' ubuntu = ubuntu ']'
+ [[ focal =~ ^(trusty|xenial|bionic|cosmic|disco|eoan|focal)$ ]]
+ echo 'Setting up apt repository... '
Setting up apt repository...
+ install_apt
+ export DEBIAN_FRONTEND=noninteractive
+ DEBIAN_FRONTEND=noninteractive
+ apt_update
+ echo -n 'Running apt-get update... '
Running apt-get update... + apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Hit:6 https://hb.bizmrg.com/tarantool_repo/release/modules/ubuntu focal InRelease
Get:5 https://download.tarantool.org/tarantool/777/ubuntu focal InRelease [30.6 kB]
Err:5 https://download.tarantool.org/tarantool/777/ubuntu focal InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
E: Failed to fetch https://download.tarantool.org/tarantool/777/ubuntu/dists/focal/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'https://download.tarantool.org/tarantool/777/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
+ echo done.
done.
+ curl_check
+ echo -n 'Checking for curl... '
Checking for curl... + command -v curl
+ echo

+ echo -n 'Detected curl... '
Detected curl... + echo done.
done.
+ gpg_check
+ echo -n 'Checking for gpg... '
Checking for gpg... + command -v gpg
+ echo

+ echo 'Detected gpg...'
Detected gpg...
+ echo done.
done.
+ echo -n 'Installing apt-transport-https... '
Installing apt-transport-https... + apt-get install -y apt-transport-https
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (2.0.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+ echo done.
done.
+ gpg_key_url=https://download.tarantool.org/tarantool/888/gpgkey
+ gpg_key_url_modules=https://download.tarantool.org/tarantool/modules/gpgkey
+ apt_source_path=/etc/apt/sources.list.d/tarantool_888.list
+ echo -n 'Importing Tarantool gpg key... '
Importing Tarantool gpg key... + curl -L https://download.tarantool.org/tarantool/888/gpgkey
+ apt-key add -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   160  100   160    0     0   3200      0 --:--:-- --:--:-- --:--:--  3200
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 30569  100 30569    0     0  33191      0 --:--:-- --:--:-- --:--:-- 33191
gpg: no valid OpenPGP data found.
+ curl -L https://download.tarantool.org/tarantool/modules/gpgkey
+ apt-key add -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   160  100   160    0     0   3902      0 --:--:-- --:--:-- --:--:--  3902
100  2436  100  2436    0     0  17525      0 --:--:-- --:--:-- --:--:-- 17525
OK
+ echo done.
done.
+ rm -f /etc/apt/sources.list.d/tarantool_777.list
+ echo 'deb https://download.tarantool.org/tarantool/888/ubuntu/ focal main'
+ echo 'deb-src https://download.tarantool.org/tarantool/888/ubuntu/ focal main'
+ echo 'deb https://download.tarantool.org/tarantool/modules/ubuntu/ focal main'
+ echo 'deb-src https://download.tarantool.org/tarantool/modules/ubuntu/ focal main'
+ mkdir -p /etc/apt/preferences.d/
+ echo -e 'Package: tarantool\nPin: origin download.tarantool.org\nPin-Priority: 1001'
+ echo 'The repository is setup! Tarantool can now be installed.'
The repository is setup! Tarantool can now be installed.
+ apt_update
+ echo -n 'Running apt-get update... '
Running apt-get update... + apt-get update
Hit:2 https://hb.bizmrg.com/tarantool_repo/release/modules/ubuntu focal InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:1 https://download.tarantool.org/tarantool/888/ubuntu focal InRelease [30.6 kB]
Err:1 https://download.tarantool.org/tarantool/888/ubuntu focal InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
E: Failed to fetch https://download.tarantool.org/tarantool/888/ubuntu/dists/focal/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'https://download.tarantool.org/tarantool/888/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
+ echo done.
done.
+ echo

+ echo 'Tarantool 888 is ready to be installed'
Tarantool 888 is ready to be installed
+ '[' 0 = 0 ']'
+ apt-get install -y tarantool
Reading package lists... Done
Building dependency tree
Reading state information... Done
tarantool is already the newest version (2.7.1.159.g254fdd14f-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with installer.sh and the detect_ver function. Reproduce the empty VER and nonexistent-version commands shown in the issue, then trace how the selected version is used for repository setup. Done means the configured default is applied consistently and an invalid version does not leave a misleading repository or installation state.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.