Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS support #1732

Merged
merged 24 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a83c926
Attempt to make DockStarter work with an immutable filesystem
dylanmtaylor Feb 20, 2024
970b8fd
Update symlink_ds.sh
dylanmtaylor Feb 20, 2024
2f4c55e
Update symlink_ds.sh
dylanmtaylor Feb 20, 2024
9c4fbcb
We don't need to have a package manager install things if they are al…
dylanmtaylor Feb 20, 2024
0c7fc0e
fix: trailing whitespace
dylanmtaylor Feb 20, 2024
269ea81
fix: shellcheck issues
dylanmtaylor Feb 20, 2024
5c04991
Make this less verbose
dylanmtaylor Feb 20, 2024
87be829
Ateempt to implement suggestions
dylanmtaylor Feb 21, 2024
aa8b469
fix: unnecessary data was getting output to the console
dylanmtaylor Feb 21, 2024
a22c74a
fix: missing then
dylanmtaylor Feb 21, 2024
341db82
Add a check for 'docker compose'
dylanmtaylor Feb 21, 2024
378c696
chore: remove some whitespace
dylanmtaylor Feb 21, 2024
97898f2
chore: try to make shfmt happy
dylanmtaylor Feb 21, 2024
7ff9e15
Implement suggestions
dylanmtaylor Feb 21, 2024
20ca452
fix: swap target to correct control variable
dylanmtaylor Feb 21, 2024
61338d0
fix: Missing $
dylanmtaylor Feb 21, 2024
6429e80
fix: missed one.
dylanmtaylor Feb 21, 2024
a5af01e
change compose check logic
dylanmtaylor Feb 21, 2024
fb16a28
Merge pull request #1731 from dylanmtaylor/patch-1
nemchik Feb 23, 2024
8c5c21d
refactor: :recycle: symlink adjustments
nemchik Feb 23, 2024
6ae8a50
refactor: :recycle: pm adjustments
nemchik Feb 23, 2024
2a8d29c
refactor: :recycle: symlink adjustments
nemchik Feb 23, 2024
d3f9ea3
Merge branch 'master' into os-support
nemchik Feb 23, 2024
b1dae06
refactor: :recycle: pm adjustments
nemchik Feb 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .scripts/package_manager_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,22 @@ package_manager_run() {
elif [[ -n "$(command -v yum)" ]]; then
run_script "pm_yum_${ACTION}"
else
fatal "Supported package manager not detected!"
if [[ ${ACTION} == "install" ]]; then
local COMMAND_DEPS=("curl" "git" "grep" "sed" "whiptail")
for COMMAND_DEP in "${COMMAND_DEPS[@]}"; do
if [[ -z "$(command -v "${COMMAND_DEP}")" ]]; then
fatal "${F[C]}${COMMAND_DEP}${NC} is not available. Please install ${F[C]}${COMMAND_DEP}${NC} and try again."
fi
done
elif [[ ${ACTION} == "install_docker" ]]; then
if [[ -z "$(command -v docker)" ]]; then
fatal "${F[C]}docker${NC} is not available. Please install ${F[C]}docker${NC} and try again."
fi
if ! docker compose version > /dev/null 2>&1; then
warn "Please see https://docs.docker.com/compose/install/linux/ to install ${F[C]}docker compose${NC}"
fatal "${F[C]}docker compose${NC} is not available. Please install ${F[C]}docker compose${NC} and try again."
fi
fi
fi
}

Expand Down
35 changes: 18 additions & 17 deletions .scripts/symlink_ds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@ IFS=$'\n\t'
symlink_ds() {
run_script 'set_permissions' "${SCRIPTNAME}"

# /usr/bin/ds
if [[ -L "/usr/bin/ds" ]] && [[ ${SCRIPTNAME} != "$(readlink -f /usr/bin/ds)" ]]; then
info "Attempting to remove /usr/bin/ds symlink."
sudo rm -f "/usr/bin/ds" || fatal "Failed to remove file.\nFailing command: ${F[C]}sudo rm -f \"/usr/bin/ds\""
fi
if [[ ! -L "/usr/bin/ds" ]]; then
info "Creating /usr/bin/ds symbolic link for DockSTARTer."
sudo ln -s -T "${SCRIPTNAME}" /usr/bin/ds || fatal "Failed to create symlink.\nFailing command: ${F[C]}sudo ln -s -T \"${SCRIPTNAME}\" /usr/bin/ds"
fi
local SYMLINK_TARGETS=("/usr/bin/ds" "/usr/local/bin/ds")

# /usr/local/bin/ds
if [[ -L "/usr/local/bin/ds" ]] && [[ ${SCRIPTNAME} != "$(readlink -f /usr/local/bin/ds)" ]]; then
info "Attempting to remove /usr/local/bin/ds symlink."
sudo rm -f "/usr/local/bin/ds" || fatal "Failed to remove file.\nFailing command: ${F[C]}sudo rm -f \"/usr/local/bin/ds\""
fi
if [[ ! -L "/usr/local/bin/ds" ]]; then
info "Creating /usr/local/bin/ds symbolic link for DockSTARTer."
sudo ln -s -T "${SCRIPTNAME}" /usr/local/bin/ds || fatal "Failed to create symlink.\nFailing command: ${F[C]}sudo ln -s -T \"${SCRIPTNAME}\" /usr/local/bin/ds"
if findmnt -n /usr | grep -P "\bro\b" > /dev/null; then
SYMLINK_TARGETS=("${HOME}/bin/ds" "${HOME}/.local/bin/ds")
fi

for SYMLINK_TARGET in "${SYMLINK_TARGETS[@]}"; do
if [[ -L ${SYMLINK_TARGET} ]] && [[ ${SCRIPTNAME} != "$(readlink -f "${SYMLINK_TARGET}")" ]]; then
info "Attempting to remove ${SYMLINK_TARGET} symlink."
sudo rm -f "${SYMLINK_TARGET}" || fatal "Failed to remove file.\nFailing command: ${F[C]}sudo rm -f \"${SYMLINK_TARGET}\""
fi
if [[ ! -L ${SYMLINK_TARGET} ]]; then
info "Creating ${SYMLINK_TARGET} symbolic link for DockSTARTer."
mkdir -p "$(dirname "${SYMLINK_TARGET}")" || fatal "Failed to create directory.\nFailing command: ${F[C]}mkdir -p \"$(dirname "${SYMLINK_TARGET}")\""
sudo ln -s -T "${SCRIPTNAME}" "${SYMLINK_TARGET}" || fatal "Failed to create symlink.\nFailing command: ${F[C]}sudo ln -s -T \"${SCRIPTNAME}\" \"${SYMLINK_TARGET}\""
fi
if [[ ${PATH} != *"$(dirname "${SYMLINK_TARGET}")"* ]]; then
warn "${F[C]}$(dirname "${SYMLINK_TARGET}")${NC} not found in PATH. Please add it to your PATH in order to use the ${F[C]}ds${NC} command alias."
fi
done
}

test_symlink_ds() {
Expand Down