init
This commit is contained in:
42
cloudcommander/CHANGELOG.md
Normal file
42
cloudcommander/CHANGELOG.md
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
## 15.9.7 (28-06-2021)
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
- Allow mounting SMB shares
|
||||
- Allow mounting local drives
|
||||
|
||||
## 15.9.6 (14-06-2021)
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.9.5 (09-06-2021)
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.9.4 (23-05-2021)
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.9.4
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.9.3
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.9.2
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.9.1
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.9.0
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.8.1
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.8.0
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.7.1
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
## 15.7.0
|
||||
- Update to latest version from coderaiser/cloudcmd
|
||||
|
||||
39
cloudcommander/Dockerfile
Normal file
39
cloudcommander/Dockerfile
Normal file
@@ -0,0 +1,39 @@
|
||||
ARG BUILD_VERSION
|
||||
ARG BUILD_UPSTREAM="15.9.7"
|
||||
FROM coderaiser/cloudcmd:$BUILD_UPSTREAM
|
||||
|
||||
COPY run.sh /
|
||||
|
||||
ARG BASHIO_VERSION=0.13.0
|
||||
|
||||
RUN \
|
||||
################
|
||||
# Install apps #
|
||||
################
|
||||
apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
jq \
|
||||
cifs-utils \
|
||||
keyutils \
|
||||
\
|
||||
##################
|
||||
# Install bashio #
|
||||
##################
|
||||
&& mkdir -p /tmp/bashio \
|
||||
&& curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" \
|
||||
| tar -xzf - --strip 1 -C /tmp/bashio \
|
||||
&& mv /tmp/bashio/lib /usr/lib/bashio \
|
||||
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \
|
||||
&& rm -rf /tmp/bashio \
|
||||
\
|
||||
/var/{cache,log}/* \
|
||||
/var/lib/apt/lists/* \
|
||||
\
|
||||
###############
|
||||
# Permissions #
|
||||
###############
|
||||
&& chmod 777 /run.sh
|
||||
|
||||
ENTRYPOINT [ "/run.sh" ]
|
||||
|
||||
VOLUME [ "/data" ]
|
||||
28
cloudcommander/README.md
Normal file
28
cloudcommander/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# Home assistant add-on: Cloudcommander
|
||||
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield]
|
||||
|
||||
## About
|
||||
|
||||
Cloud Commander a file manager for the web with console and editor.
|
||||
This addon is based on the [docker image](https://hub.docker.com/r/coderaiser/cloudcmd).
|
||||
|
||||
## Installation
|
||||
|
||||
The installation of this add-on is pretty straightforward and not different in
|
||||
comparison to installing any other Hass.io add-on.
|
||||
|
||||
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
|
||||
1. Install this add-on.
|
||||
1. Click the `Save` button to store your configuration.
|
||||
1. Start the add-on.
|
||||
1. Check the logs of the add-on to see if everything went well.
|
||||
|
||||
## Configuration
|
||||
|
||||
Webui can be found at `<your-ip>:8000`.
|
||||
|
||||
[repository]: https://github.com/alexbelgium/hassio-addons
|
||||
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
|
||||
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
|
||||
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
|
||||
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
|
||||
48
cloudcommander/apparmor.txt
Normal file
48
cloudcommander/apparmor.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
#include <tunables/global>
|
||||
|
||||
profile cloudcommander_addon flags=(attach_disconnected,mediate_deleted) {
|
||||
#include <abstractions/base>
|
||||
|
||||
capability,
|
||||
file,
|
||||
mount,
|
||||
umount,
|
||||
remount,
|
||||
|
||||
capability setgid,
|
||||
capability setuid,
|
||||
capability sys_admin,
|
||||
capability dac_read_search,
|
||||
# capability dac_override,
|
||||
# capability sys_rawio,
|
||||
|
||||
# S6-Overlay
|
||||
/bin/** ix,
|
||||
/usr/bin/** ix,
|
||||
/usr/lib/bashio/** ix,
|
||||
/etc/s6/** rix,
|
||||
/run/s6/** rix,
|
||||
/etc/services.d/** rwix,
|
||||
/etc/cont-init.d/** rwix,
|
||||
/etc/cont-finish.d/** rwix,
|
||||
/init rix,
|
||||
/var/run/** mrwkl,
|
||||
/var/run/ mrwkl,
|
||||
/dev/i2c-1 mrwkl,
|
||||
# Files required
|
||||
/dev/sda1 mrwkl,
|
||||
/dev/sdb1 mrwkl,
|
||||
/dev/mmcblk0p1 mrwkl,
|
||||
/dev/* mrwkl,
|
||||
/tmp/** mrkwl,
|
||||
|
||||
# Data access
|
||||
/data/** rw,
|
||||
|
||||
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
|
||||
ptrace (trace,read) peer=docker-default,
|
||||
|
||||
# docker daemon confinement requires explict allow rule for signal
|
||||
signal (receive) set=(kill,term) peer=/usr/bin/docker,
|
||||
|
||||
}
|
||||
38
cloudcommander/config.json
Normal file
38
cloudcommander/config.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "Cloudcommander",
|
||||
"version": "15.9.7",
|
||||
"upstream": "15.9.7",
|
||||
"slug": "cloudcommander",
|
||||
"description": "Cloud Commander a file manager for the web with console and editor",
|
||||
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/cloudcommander#readme",
|
||||
"arch": [
|
||||
"aarch64",
|
||||
"amd64",
|
||||
"armv7",
|
||||
"armhf"
|
||||
],
|
||||
"ports": {
|
||||
"8000/tcp": 8000
|
||||
},
|
||||
"ports_description": {
|
||||
"8000/tcp": "Web UI port (required)"
|
||||
},
|
||||
"map": [
|
||||
"ssl"
|
||||
],
|
||||
"webui": "http://[HOST]:[PORT:8000]",
|
||||
"privileged": [
|
||||
"SYS_ADMIN",
|
||||
"DAC_READ_SEARCH"
|
||||
],
|
||||
"full_access": true,
|
||||
"environment": {},
|
||||
"options": {},
|
||||
"schema": {
|
||||
"localdisks": "str?",
|
||||
"networkdisks": "str?",
|
||||
"cifsusername": "str?",
|
||||
"cifspassword": "str?",
|
||||
"smbv1": "bool?"
|
||||
}
|
||||
}
|
||||
BIN
cloudcommander/icon.png
Normal file
BIN
cloudcommander/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
BIN
cloudcommander/logo.png
Normal file
BIN
cloudcommander/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
134
cloudcommander/run.sh
Normal file
134
cloudcommander/run.sh
Normal file
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env bashio
|
||||
|
||||
##########
|
||||
# BANNER #
|
||||
##########
|
||||
|
||||
if bashio::supervisor.ping; then
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
||||
bashio::log.blue " $(bashio::addon.description)"
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
|
||||
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
||||
if bashio::var.true "$(bashio::addon.update_available)"; then
|
||||
bashio::log.magenta ' There is an update available for this add-on!'
|
||||
bashio::log.magenta \
|
||||
" Latest add-on version: $(bashio::addon.version_latest)"
|
||||
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
||||
else
|
||||
bashio::log.green ' You are running the latest version of this add-on.'
|
||||
fi
|
||||
|
||||
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
||||
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
||||
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
||||
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
||||
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue \
|
||||
' Please, share the above information when looking for help'
|
||||
bashio::log.blue \
|
||||
' or support in, e.g., GitHub, forums or the Discord chat.'
|
||||
bashio::log.green \
|
||||
' https://github.com/alexbelgium/hassio-addons'
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
fi
|
||||
|
||||
######################
|
||||
# MOUNT LOCAL SHARES #
|
||||
######################
|
||||
|
||||
# Mount local Share if configured and if Protection Mode is active
|
||||
if bashio::config.has_value 'localdisks'; then
|
||||
bashio::log.info 'Mounting local hdd...'
|
||||
bashio::require.unprotected
|
||||
MOREDISKS=$(bashio::config 'localdisks')
|
||||
bashio::log.info "Local Disks mounting.. ${MOREDISKS}" && \
|
||||
for disk in ${MOREDISKS//,/ } # Separate comma separated values
|
||||
do
|
||||
bashio::log.info "Mount ${disk}"
|
||||
mkdir -p /share/$disk && \
|
||||
if [ ! -d /share/$disk ]; then
|
||||
echo "Creating /share/$disk"
|
||||
mkdir -p /share/$disk
|
||||
chown -R abc:abc /share/$disk
|
||||
fi
|
||||
mount /dev/$disk /mnt && \
|
||||
bashio::log.info "Success! Mounted to /nmt/$disk"
|
||||
done || \
|
||||
bashio::log.warning "Error, /dev/$disk couldn't be mounted. Is priviledged mode on?"
|
||||
fi || true
|
||||
|
||||
####################
|
||||
# MOUNT SMB SHARES #
|
||||
####################
|
||||
if bashio::config.has_value 'networkdisks'; then
|
||||
# Mount CIFS Share if configured and if Protection Mode is active
|
||||
bashio::log.info 'Mounting smb share(s)...'
|
||||
|
||||
# Define variables
|
||||
MOREDISKS=$(bashio::config 'networkdisks')
|
||||
CIFS_USERNAME=$(bashio::config 'cifsusername')
|
||||
CIFS_PASSWORD=$(bashio::config 'cifspassword')
|
||||
MOUNTED=false
|
||||
SMBVERS=""
|
||||
SECVERS=""
|
||||
|
||||
if bashio::config.has_value 'cifsdomain'; then
|
||||
DOMAIN=",domain=$(bashio::config 'cifsdomain')"
|
||||
else
|
||||
DOMAIN=""
|
||||
fi
|
||||
|
||||
# Mounting disks
|
||||
for disk in ${MOREDISKS//,/ } # Separate comma separated values
|
||||
do
|
||||
# Clean name of network share
|
||||
disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name
|
||||
diskname=${disk//\\//} #replace \ with /
|
||||
diskname=${diskname##*/} # Get only last part of the name
|
||||
# Prepare mount point
|
||||
mkdir -p /mnt/$diskname
|
||||
chown -R root:root /mnt/$diskname
|
||||
|
||||
#Tries to mount with default options
|
||||
mount -t cifs -o rw,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$DOMAIN $disk /mnt/$diskname 2>ERRORCODE && MOUNTED=true || MOUNTED=false
|
||||
|
||||
# if Fail test different smb and sec versions
|
||||
if [ $MOUNTED = false ]; then
|
||||
for SMBVERS in ",vers=3" ",vers=1.0" ",vers=2.1" ",vers=3.0" ",nodfs" ",uid=0,gid=0,forceuid,forcegid" ",noforceuid,noforcegid" ",${DOMAIN}"
|
||||
do
|
||||
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS $disk /mnt/$diskname 2>/dev/null && MOUNTED=true && break || MOUNTED=false
|
||||
for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5"
|
||||
do
|
||||
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS $disk /mnt/$disk name 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# Messages
|
||||
if [ $MOUNTED = true ]; then
|
||||
#Test write permissions
|
||||
touch /mnt/$diskname/testaze && rm /mnt/$diskname/testaze && bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" || bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
||||
else
|
||||
# message if still fail
|
||||
bashio::log.fatal "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD. Please check your remote share path, username, password, domain, try putting 0 in UID and GID" # Mount share
|
||||
bashio::log.fatal "Error read : $(<ERRORCODE)" # Mount share
|
||||
rm ERRORCODE
|
||||
fi
|
||||
|
||||
done
|
||||
fi || true
|
||||
|
||||
###############
|
||||
# LAUNCH APPS #
|
||||
###############
|
||||
|
||||
bashio::log.info "The server will start. Please wait 30 seconds before the web UI is available. Enjoy !"
|
||||
|
||||
./usr/src/app/bin/cloudcmd.mjs
|
||||
Reference in New Issue
Block a user