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

#113 fix inkscape install for other linux distros (non ubuntu) #119

Merged
merged 4 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion docker-gem-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ runs:
using: "composite"
steps:
- run: |
add-apt-repository ppa:inkscape.dev/stable
source /etc/os-release
if [ "$ID" == "ubuntu" ]; then
add-apt-repository ppa:inkscape.dev/stable
fi
apt-get update -y && apt-get install -y gcc g++ ruby-dev
shell: bash

Expand Down
32 changes: 30 additions & 2 deletions inkscape-setup-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,48 @@ runs:

win_prefix = "C:\\Program Files\\Inkscape\\bin"

def os_release():
try:
return platform.freedesktop_os_release()
except AttributeError:
properties = {}
try:
with open("/etc/os-release", "r") as file:
for line in file:
line = line.strip()
if line and not line.startswith("#"):
key, value = line.split("=", 1)
properties[key] = value.strip('"')
except:
pass
return properties

os_release_dict = os_release()

print(os_release_dict)

platform_name = "Ubuntu" if os_release_dict.get("ID", None) == "ubuntu" else platform.system()

cmds = {
"Darwin": [ "HOMEBREW_CASK_OPTS='--no-quarantine' brew install --cask inkscape", "inkscape --version" ],
"Windows": [
"choco install --no-progress -y inkscape",
"echo {}>> {}".format(win_prefix, os.environ["GITHUB_PATH"]),
"\"{}\\inkscape\" --version".format(win_prefix)
],
"Linux": [
"Ubuntu": [
"sudo add-apt-repository ppa:inkscape.dev/stable",
"sudo apt update",
"sudo apt install inkscape",
"which inkscape",
"inkscape --version"
],
"Linux": [
"wget https://inkscape.org/gallery/item/42330/Inkscape-0e150ed-x86_64.AppImage -O /usr/local/bin/inkscape",
"sudo chmod +x /usr/local/bin/inkscape",
"inkscape --version"
]
}.get(platform.system(), [ "echo \"Unsupported platform: {}\"".format(platform.system()), "exit 1" ])
}.get(platform_name, [ "echo \"Unsupported platform: {}\"".format(platform_name), "exit 1" ])

for cmd in cmds:
if os.system(cmd) != 0:
Expand Down
Loading