-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Create install_arch.sh #335
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2a723da
Create install_arch.sh
CooperGerman 1696759
Update install script in readme
163c809
Add .history to .gitignore
81ef9b1
Merged arch and debian install scripts for a generic one
fc6ab9e
Merge branch 'Donkie:master' into master
CooperGerman 047b0b2
Added os detection logging in terminal
CooperGerman fd33446
Merge branch 'Donkie:master' into master
CooperGerman c7f02f5
Fix for https://github.com/Donkie/Spoolman/pull/335#discussion_r15783…
CooperGerman a6774dd
Fix for https://github.com/Donkie/Spoolman/pull/335#discussion_r15783…
CooperGerman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,3 +203,4 @@ $RECYCLE.BIN/ | |
|
||
data/ | ||
.pdm-python | ||
.history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,38 +51,63 @@ else | |
echo -e "${ORANGE}Please look up how to install Python 3.9 or later for your specific operating system.${NC}" | ||
exit 1 | ||
fi | ||
|
||
# | ||
# Install needed system packages | ||
# Get os package manager | ||
# | ||
# Run apt-get update | ||
echo -e "${GREEN}Updating apt-get cache...${NC}" | ||
sudo apt-get update || exit 1 | ||
if [[ -f /etc/os-release ]]; then | ||
source /etc/os-release | ||
if [[ "$ID_LIKE" == *"debian"* ]]; then | ||
pkg_manager="apt-get" | ||
Donkie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
update_cmd="sudo $pkg_manager update" | ||
install_cmd="sudo $pkg_manager install -y" | ||
elif [[ "$ID_LIKE" == *"arch"* ]]; then | ||
pkg_manager="pacman" | ||
update_cmd="sudo $pkg_manager -Sy" | ||
install_cmd="sudo $pkg_manager -S --noconfirm" | ||
else | ||
echo -e "${ORANGE}Your operating system is not supported. Either try to install manually or reach out to spoolman github for support.${NC}" | ||
exit 1 | ||
fi | ||
fi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If /etc/os-release is not available it should also fail |
||
|
||
install_packages=0 | ||
# Run pkg manager update | ||
echo -e "${GREEN}Updating $pkg_manager cache...${NC}" | ||
$update_cmd || exit 1 | ||
packages="" | ||
if ! python3 -c 'import venv, ensurepip' &>/dev/null; then | ||
echo -e "${ORANGE}Python venv module is not accessible. Installing venv...${NC}" | ||
install_packages=1 | ||
if [[ "$pkg_manager" == "apt-get" ]]; then | ||
packages+="python3-venv" | ||
elif [[ "$pkg_manager" == "pacman" ]]; then | ||
packages+="python-virtualenv" | ||
fi | ||
fi | ||
|
||
if ! command -v pip3 &>/dev/null; then | ||
echo -e "${ORANGE}Python pip is not installed. Installing pip...${NC}" | ||
install_packages=1 | ||
if [[ "$pkg_manager" == "apt-get" ]]; then | ||
packages+="python3-pip" | ||
Donkie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
elif [[ "$pkg_manager" == "pacman" ]]; then | ||
packages+="python-pip" | ||
fi | ||
fi | ||
|
||
if ! command -v pg_config &>/dev/null; then | ||
echo -e "${ORANGE}pg_config is not available. Installing libpq-dev...${NC}" | ||
install_packages=1 | ||
if [[ "$pkg_manager" == "apt-get" ]]; then | ||
packages+="libpq-dev" | ||
elif [[ "$pkg_manager" == "pacman" ]]; then | ||
packages+="postgresql-libs" | ||
fi | ||
fi | ||
|
||
if ! command -v unzip &>/dev/null; then | ||
echo -e "${ORANGE}unzip is not available. Installing unzip...${NC}" | ||
install_packages=1 | ||
packages+="unzip" | ||
fi | ||
|
||
if [ "$install_packages" -eq 1 ]; then | ||
# sudo apt-get update | ||
sudo apt-get install -y python3-pip python3-venv libpq-dev unzip || exit 1 | ||
if [[ -n "$packages" ]]; then | ||
$install_cmd $packages || exit 1 | ||
fi | ||
|
||
# | ||
|
@@ -114,11 +139,15 @@ fi | |
echo -e "${GREEN}Installing system-wide pip packages needed for Spoolman...${NC}" | ||
if [[ $is_externally_managed_env ]]; then | ||
echo -e "${GREEN}Installing the packages using apt-get instead of pip since pip is externally managed...${NC}" | ||
apt_packages=("python3-setuptools" "python3-wheel") | ||
sudo apt-get install -y "${apt_packages[@]}" || exit 1 | ||
if [[ "$pkg_manager" == "apt-get" ]]; then | ||
packages="python3-setuptools python3-wheel" | ||
elif [[ "$pkg_manager" == "pacman" ]]; then | ||
packages="python-setuptools python-wheel" | ||
fi | ||
$install_cmd $packages || exit 1 | ||
else | ||
packages=("setuptools" "wheel") | ||
for package in "${packages[@]}"; do | ||
packages="setuptools wheel" | ||
for package in $packages; do | ||
if ! pip3 show "$package" &>/dev/null; then | ||
echo -e "${GREEN}Installing $package...${NC}" | ||
pip3 install --user "$package" || exit 1 | ||
|
@@ -138,9 +167,8 @@ fi | |
# Install Spoolman | ||
# | ||
|
||
# Install PDM dependencies | ||
# Install dependencies | ||
echo -e "${GREEN}Installing Spoolman backend and its dependencies...${NC}" | ||
|
||
# Create venv if it doesn't exist | ||
if [ ! -d ".venv" ]; then | ||
python3 -m venv .venv || exit 1 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out on Debian itself, ID_LIKE doesn't exist, only ID does, which is "debian". So you should check for either ID_LIKE like you do here, or
"$ID" == *"debian"*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I check for both ID and ID_LIKE variables, this should do the trick for you.