forked from chrisjbawden/cockpit-dockermanager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick-deploy.sh
More file actions
51 lines (41 loc) · 1.3 KB
/
Copy pathquick-deploy.sh
File metadata and controls
51 lines (41 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Suppress command output
exec &> /dev/null
# Check if the OS is Ubuntu
if [ "$(lsb_release -si)" != "Ubuntu" ]; then
echo ""
echo "This script was created for Ubuntu"
echo ""
read -p "This script is intended for Ubuntu - Do you want to continue? (y/n): " confirm
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
echo ""
echo "Script aborted."
sleep 5
exit 1
fi
fi
# Define the install target
target_directory="/usr/share/cockpit/dockermanager"
# Handle upgrade logic
if [ "$1" = "upgrade" ]; then
if [ -d "$target_directory" ]; then
rm -rf "$target_directory" || { echo "Failed to delete existing directory."; sleep 5; exit 1; }
fi
fi
# Backup existing directory if it exists
if [ -d "$target_directory" ]; then
mv "$target_directory" "${target_directory}.old" || { echo "Failed to rename existing directory."; sleep 5; exit 1; }
fi
# Download .tar file from GitHub
tar_url="https://github.com/chrisjbawden/cockpit-docker-manager/raw/refs/heads/main/dockermanager.tar"
wget "$tar_url" -O dockermanager.tar
# Create target directory and extract contents into it
mkdir -p "$target_directory"
tar -xf dockermanager.tar -C "$target_directory"
# Clean up tar file
rm dockermanager.tar
echo ""
echo ""
echo "Docker Manager deployed successfully to $target_directory"
echo ""
echo ""