Compare commits

..

23 Commits

Author SHA1 Message Date
lunardunno
7c6daf1e83 Final Cut 2023-11-25 14:46:20 +04:00
lunardunno
f4c06f952e script minimization 2023-11-25 13:46:19 +04:00
lunardunno
ab13e98ad2 some changes 2023-11-25 10:34:43 +04:00
lunardunno
4e29ce7139 returned condition
returned condition before enable --now docker
2023-11-25 06:29:53 +04:00
lunardunno
60d58915c0 rolling back some changes 2023-11-24 18:00:10 +04:00
lunardunno
c0302b7a01 cancel changes for Ubuntu 22 2023-11-24 15:39:29 +04:00
lunardunno
fecdd60787 fix lines not found 2023-11-24 08:34:59 +04:00
lunardunno
75987b8b45 script minimization 2023-11-24 06:19:17 +04:00
lunardunno
4109e9db58 improved support for Ubuntu 22.04 2023-11-24 05:46:22 +04:00
lunardunno
8e10144717 bringing the code to uniformity 2023-11-23 19:08:27 +04:00
lunardunno
2410bf6838 Apply suggestions from code review
Co-authored-by: tiaga <10153548+tiaga@users.noreply.github.com>
2023-11-23 17:59:10 +04:00
lunardunno
bd595f2c94 status check via variable
returned docker status check via variable
2023-11-23 07:25:18 +04:00
lunardunno
7d7a4c154d returned the penultimate line 2023-11-23 04:34:37 +04:00
lunardunno
d66304f814 deleting the penultimate line
Removed the line “if! command -v docker > /dev/null 2>&1; then display "Docker Installation Error"; output 1; fi;\", because of it the script did not interrupt execution.
docker presence check function, executes docker --version/
2023-11-22 23:43:10 +04:00
lunardunno
e7a1a93d84 rollback some changes
rollback some changes to dev
2023-11-22 07:03:53 +04:00
lunardunno
9f29bc9afe improved readability 2023-11-21 04:41:54 +04:00
lunardunno
a6ffd2a675 changing places for pauses and checks
Return to -yq for Debian and Ubuntu.
Added places to check fuser and lsof installation results.
Moved places for check sudo and docker installation results.
The location of pauses has been changed.
All pauses are reduced to 5s.
2023-11-21 02:33:43 +04:00
lunardunno
795737bbc3 introducing sudo check
introduced check for the presence of sudo at the end of script execution
2023-11-20 06:44:50 +04:00
lunardunno
61f55af76b Changing sleep timer
Adding a pause before checking docker status.
Change the pause before attempting to update docker.
2023-11-20 04:19:54 +04:00
lunardunno
6c5a12e626 Minimization and fixes of the script for running docker.service
Script minimization.
Minimizing log information for Debian and Ubuntu.
Changing the startup logic of docker.
Excluding $dist debian from sudo systemctl Enable --now docker since this is done in the post-installation phase.
Exception installation of Curl if docker.service status is not active.
Change startup to restart if docker.service status is not active.
Returning a 5s delay for correct execution when reinstalling docker.io on Ubuntu22.
Fix the docker installation status check at the end of the script.
Introduced docker.service status check and corresponding error notification at the end of the script.
2023-11-19 23:04:18 +04:00
pokamest
ef0530ec6b Merge pull request #420 from amnezia-vpn/adaptation_to_different_os
Improve logic of install_docker.sh
2023-11-17 11:51:58 -08:00
pokamest
e8a2e54d05 Typo fix 2023-11-15 12:51:39 +00:00
tiaga
362a82f944 Improve logic of install_docker.sh
- check packages update only when it's required
- avoid `dnf/yum update` for RHEL-based systems
2023-11-14 16:57:16 +07:00
5 changed files with 15 additions and 19 deletions

View File

@@ -36,7 +36,7 @@ enum ErrorCode
ServerPacketManagerError,
// Ssh connection errors
SshRequsetDeniedError, SshInterruptedError, SshInternalError,
SshRequestDeniedError, SshInterruptedError, SshInternalError,
SshPrivateKeyError, SshPrivateKeyFormatError, SshTimeoutError,
// Ssh sftp errors

View File

@@ -19,7 +19,7 @@ QString errorString(ErrorCode code){
case(ServerUserNotInSudo): return QObject::tr("The user does not have permission to use sudo");
// Libssh errors
case(SshRequsetDeniedError): return QObject::tr("Ssh request was denied");
case(SshRequestDeniedError): return QObject::tr("Ssh request was denied");
case(SshInterruptedError): return QObject::tr("Ssh request was interrupted");
case(SshInternalError): return QObject::tr("Ssh internal error");
case(SshPrivateKeyError): return QObject::tr("Invalid private key or invalid passphrase entered");

View File

@@ -368,8 +368,6 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent
return ErrorCode::ServerPacketManagerError;
if (stdOut.contains("command not found"))
return ErrorCode::ServerDockerFailedError;
if (stdOut.contains("Docker status is not active"))
return ErrorCode::ServerDockerFailedError;
return error;
}

View File

@@ -333,7 +333,7 @@ namespace libssh {
switch (errorCode) {
case(SSH_NO_ERROR): return ErrorCode::NoError;
case(SSH_REQUEST_DENIED): return ErrorCode::SshRequsetDeniedError;
case(SSH_REQUEST_DENIED): return ErrorCode::SshRequestDeniedError;
case(SSH_EINTR): return ErrorCode::SshInterruptedError;
case(SSH_FATAL): return ErrorCode::SshInternalError;
default: return ErrorCode::SshInternalError;

View File

@@ -1,19 +1,17 @@
if which apt-get > /dev/null 2>&1; then pm=$(which apt-get); docker_pkg="docker.io"; dist="debian";\
elif which dnf > /dev/null 2>&1; then pm=$(which dnf); docker_pkg="docker"; dist="fedora";\
elif which yum > /dev/null 2>&1; then pm=$(which yum); docker_pkg="docker"; dist="centos";\
if which apt-get > /dev/null 2>&1; then pm=$(which apt-get); silent_inst="-yq install"; check_pkgs="-yq update"; docker_pkg="docker.io"; dist="debian";\
elif which dnf > /dev/null 2>&1; then pm=$(which dnf); silent_inst="-yq install"; check_pkgs="-yq check-update"; docker_pkg="docker"; dist="fedora";\
elif which yum > /dev/null 2>&1; then pm=$(which yum); silent_inst="-y -q install"; check_pkgs="-y -q check-update"; docker_pkg="docker"; dist="centos";\
else echo "Packet manager not found"; exit 1; fi;\
echo "Dist: $dist, Packet manager: $pm, Docker pkg: $docker_pkg";\
echo "Dist: $dist, Packet manager: $pm, Install command: $silent_inst, Check pkgs command: $check_pkgs, Docker pkg: $docker_pkg";\
if [ "$dist" = "debian" ]; then export DEBIAN_FRONTEND=noninteractive; fi;\
if ! command -v sudo > /dev/null 2>&1; then $pm update -yq; $pm install -yq sudo; fi;\
if ! command -v fuser > /dev/null 2>&1; then sudo $pm install -yq psmisc; fi;\
if ! command -v lsof > /dev/null 2>&1; then sudo $pm install -yq lsof; fi;\
if ! command -v docker > /dev/null 2>&1; then sudo $pm update -yq; sudo $pm install -yq $docker_pkg;\
if [ "$dist" = "fedora" ] || [ "$dist" = "centos" ] || [ "$dist" = "debian" ]; then sudo systemctl enable docker && sudo systemctl start docker; fi;\
if ! command -v sudo > /dev/null 2>&1; then $pm $check_pkgs; $pm $silent_inst sudo; fi;\
if ! command -v fuser > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst psmisc; fi;\
if ! command -v lsof > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst lsof; fi;\
if ! command -v docker > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\
sleep 5 && sudo systemctl enable --now docker && sleep 5;\
fi;\
if [ "$dist" = "debian" ]; then \
docker_service=$(systemctl list-units --full --all | grep docker.service | grep -v inactive | grep -v dead | grep -v failed);\
if [ -z "$docker_service" ]; then sudo $pm update -yq; sudo $pm install -yq curl $docker_pkg; fi;\
sleep 3 && sudo systemctl start docker && sleep 3;\
if [ "$(systemctl is-active docker)" != "active" ]; then sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\
sleep 5 && sudo systemctl start docker && sleep 5;\
fi;\
if [ "$(systemctl is-active docker)" != "active" ]; then echo "Docker status is not active"; fi;\
if ! command -v sudo > /dev/null 2>&1; then echo "Failed to install Docker"; exit 1; fi;\
docker --version