mirror of
https://github.com/aljazceru/addons.git
synced 2026-02-18 11:24:24 +01:00
Add support for manage deps folder (#273)
* Add support for manage deps folder * Update Dockerfile * Update run.sh * Update run.sh * Update run.sh * Update Dockerfile * Add files via upload * Create CHANGELOG.md
This commit is contained in:
4
custom_deps/CHANGELOG.md
Normal file
4
custom_deps/CHANGELOG.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1
|
||||
- Initial release
|
||||
15
custom_deps/Dockerfile
Normal file
15
custom_deps/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
ARG BUILD_FROM
|
||||
FROM $BUILD_FROM
|
||||
|
||||
# Add env
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
# Setup base
|
||||
RUN apk add --no-cache \
|
||||
jq python3 gcc g++ make cmake git python3-dev
|
||||
|
||||
# Copy data
|
||||
COPY run.sh /
|
||||
RUN chmod a+x /run.sh
|
||||
|
||||
CMD [ "/run.sh" ]
|
||||
19
custom_deps/config.json
Normal file
19
custom_deps/config.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Custom deps deployment",
|
||||
"version": "0.1",
|
||||
"slug": "custom_deps",
|
||||
"description": "Manage custom python modules in Home Assistant deps",
|
||||
"url": "https://home-assistant.io/addons/custom_deps/",
|
||||
"startup": "once",
|
||||
"boot": "manual",
|
||||
"map": ["config:rw"],
|
||||
"options": {
|
||||
"pypi": [],
|
||||
"apk": []
|
||||
},
|
||||
"schema": {
|
||||
"pypi": ["str"],
|
||||
"apk": ["str"]
|
||||
},
|
||||
"image": "homeassistant/{arch}-addon-custom_deps"
|
||||
}
|
||||
BIN
custom_deps/logo.png
Normal file
BIN
custom_deps/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
30
custom_deps/run.sh
Normal file
30
custom_deps/run.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CONFIG_PATH=/data/options.json
|
||||
|
||||
PYPI=$(jq --raw-output ".pypi[]" $CONFIG_PATH)
|
||||
APK=$(jq --raw-output ".apk[] // empy" $CONFIG_PATH)
|
||||
|
||||
# Cleanup old deps
|
||||
echo "[Info] Remove old deps"
|
||||
rm -rf /config/deps/*
|
||||
|
||||
# Need custom apk for build?
|
||||
if [ ! -z "$APK" ]; then
|
||||
echo "[Info] Install apks for build"
|
||||
if ! ERROR="$(apk add --no-cache "${APK[@]}")"; then
|
||||
echo "[Error] Can't install packages!"
|
||||
echo "$ERROR" && exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install pypi modules
|
||||
echo "[Info] Install pypi modules into deps"
|
||||
export PYTHONUSERBASE=/config/deps
|
||||
if ! ERROR="$(pip3 install --user --no-cache-dir --no-dependencies "${PYPI[@]}")"; then
|
||||
echo "[Error] Can't install pypi packages!"
|
||||
echo "$ERROR" && exit 1
|
||||
fi
|
||||
|
||||
echo "[Info] done"
|
||||
Reference in New Issue
Block a user