Synology-Forum.nl
Firmware => Synology DSM algemeen => Topic gestart door: rheinen op 02 september 2022, 14:37:34
-
:?:Hoi allemaal,
Ik loop tegen een probleem aan. Hopelijk kunnen jullie mij helpen.
Ik heb Home Assistant draaien in docker op mijn DS220+. Nu probeer ik de Home Assistant Community Store (HACS) te downloaden via SSH met het volgende commando: wget -q -O - https://get.hacs.xyz | bash -
Ik krijg dan echter de foutmelding dat 'unzip' niet is geïnstalleerd. Mijn vraag: hoe krijg ik unzip geïnstalleerd?
Alvast bedankt voor jullie hulp.
Groeten Ramon
-
Tegenwoordig staat overal 7z op. Dit is een unzipper met wat meer mogelijkheden.
unzip is er ergens in het begin van DSM 6 af gegooid en door 7z vervangen. Op DSM 6.2 staat hij niet meer.
7z --help
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.utf8,Utf16=on,HugeFiles=on,4 CPUs)
Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]
-
Bedankt voor je bericht, maar het is mij niet duidelijk hoe ik HACS nu precies ge-unzipt/geïnstalleerd krijg.
@Briolet zou je mij daarmee kunnen helpen?
Edit: het is al gelukt.
-
Hoe is het je dan uiteindelijk gelukt? Ik loop tegen hetzelfde probleem aan.
-
7z --help al gedaan in PuTTY of Term ?
Dan zie n.l. alle parameters/mogelijkheden.
-
Heb enkel dit commando
wget -q -O - https://get.hacs.xyz | bash
Ben helaas niet zo aangelegd om dit dan aan te passen.
-
En ik heb geen Home Assistant om te testen.....
Daarbij, vind ik dat @rheinen ook wel even mag vermelden hoe het gelukt is.
@rheinen Het is immers een Forum, dus niet alleen vragen stellen aan het Forum en later even stiekem Reactie #4 aangepassen met "Edit: het is al gelukt".
Zou netjes zijn om dan ook te vermelden hoe, een Forum werkt 2 kanten op.
-
Het enige wat bovenstaand commando doet is, is het volgende script te downloaden en dan uit te voeren. Je kunt dat script ook op je nas zetten, de upzip commando's aanpassen en daarna het script vanaf de nas runnen. (Het zou mij zelfs storen om dat script elke keer extern op te moeten halen)
#!/bin/bash
# wget -O - https://get.hacs.xyz | bash -
set -e
RED_COLOR='\033[0;31m'
GREEN_COLOR='\033[0;32m'
GREEN_YELLOW='\033[1;33m'
NO_COLOR='\033[0m'
declare haPath
declare -a paths=(
"$PWD"
"$PWD/config"
"/config"
"$HOME/.homeassistant"
"/usr/share/hassio/homeassistant"
)
function info () { echo -e "${GREEN_COLOR}INFO: $1${NO_COLOR}";}
function warn () { echo -e "${GREEN_YELLOW}WARN: $1${NO_COLOR}";}
function error () { echo -e "${RED_COLOR}ERROR: $1${NO_COLOR}"; if [ "$2" != "false" ]; then exit 1;fi; }
function checkRequirement () {
if [ -z "$(command -v "$1")" ]; then
error "'$1' is not installed"
fi
}
checkRequirement "wget"
checkRequirement "unzip"
info "Trying to find the correct directory..."
for path in "${paths[@]}"; do
if [ -n "$haPath" ]; then
break
fi
if [ -f "$path/home-assistant.log" ]; then
haPath="$path"
else
if [ -d "$path/.storage" ] && [ -f "$path/configuration.yaml" ]; then
haPath="$path"
fi
fi
done
if [ -n "$haPath" ]; then
info "Found Home Assistant configuration directory at '$haPath'"
cd "$haPath" || error "Could not change path to $haPath"
if [ ! -d "$haPath/custom_components" ]; then
info "Creating custom_components directory..."
mkdir "$haPath/custom_components"
fi
info "Changing to the custom_components directory..."
cd "$haPath/custom_components" || error "Could not change path to $haPath/custom_components"
info "Downloading HACS"
wget "https://github.com/hacs/integration/releases/latest/download/hacs.zip"
if [ -d "$haPath/custom_components/hacs" ]; then
warn "HACS directory already exist, cleaning up..."
rm -R "$haPath/custom_components/hacs"
fi
info "Creating HACS directory..."
mkdir "$haPath/custom_components/hacs"
info "Unpacking HACS..."
unzip "$haPath/custom_components/hacs.zip" -d "$haPath/custom_components/hacs" >/dev/null 2>&1
info "Removing HACS zip file..."
rm "$haPath/custom_components/hacs.zip"
info "Installation complete."
echo
info "Remember to restart Home Assistant before you configure it"
for path in $(find "$haPath/custom_components" -maxdepth 1 -type f); do
error "Found a file in the custom_components directory: '$path' this should not be there and may cause issues not related to HACS but you will blame HACS so remove it!" false
done
else
echo
error "Could not find the directory for Home Assistant" false
echo "Manually change the directory to the root of your Home Assistant configuration"
echo "With the user that is running Home Assistant"
echo "and run the script again"
exit 1
fi
-
Dat was ik ook achter, maar wilde dit besparen omdat @Tazmanian niet zo aangelegd is. ;)
Daarbij, ik kon het wel aanpassen en hier neerzetten, maar kan het gewoon niet testen, dus vandaar mijn reactie naar @rheinen
-
Ik heb in de code unzip gewoon aangepast naar 7z
Dit moet dan voldoende zijn? of moet het "7z x" zijn?
Het bestand plaats ik dan gewoon in mijn home directory van homeassistant. Noem ik hacs.pl
Hoe kan ik dit bestand dan uitvoeren?
#!/bin/bash
set -e
RED_COLOR='\033[0;31m'
GREEN_COLOR='\033[0;32m'
GREEN_YELLOW='\033[1;33m'
NO_COLOR='\033[0m'
declare haPath
declare -a paths=(
"$PWD"
"$PWD/config"
"/config"
"$HOME/.homeassistant"
"/usr/share/hassio/homeassistant"
)
function info () { echo -e "${GREEN_COLOR}INFO: $1${NO_COLOR}";}
function warn () { echo -e "${GREEN_YELLOW}WARN: $1${NO_COLOR}";}
function error () { echo -e "${RED_COLOR}ERROR: $1${NO_COLOR}"; if [ "$2" != "false" ]; then exit 1;fi; }
function checkRequirement () {
if [ -z "$(command -v "$1")" ]; then
error "'$1' is not installed"
fi
}
checkRequirement "wget"
checkRequirement "7z"
info "Trying to find the correct directory..."
for path in "${paths[@]}"; do
if [ -n "$haPath" ]; then
break
fi
if [ -f "$path/home-assistant.log" ]; then
haPath="$path"
else
if [ -d "$path/.storage" ] && [ -f "$path/configuration.yaml" ]; then
haPath="$path"
fi
fi
done
if [ -n "$haPath" ]; then
info "Found Home Assistant configuration directory at '$haPath'"
cd "$haPath" || error "Could not change path to $haPath"
if [ ! -d "$haPath/custom_components" ]; then
info "Creating custom_components directory..."
mkdir "$haPath/custom_components"
fi
info "Changing to the custom_components directory..."
cd "$haPath/custom_components" || error "Could not change path to $haPath/custom_components"
info "Downloading HACS"
wget "https://github.com/hacs/integration/releases/latest/download/hacs.zip"
if [ -d "$haPath/custom_components/hacs" ]; then
warn "HACS directory already exist, cleaning up..."
rm -R "$haPath/custom_components/hacs"
fi
info "Creating HACS directory..."
mkdir "$haPath/custom_components/hacs"
info "Unpacking HACS..."
7z "$haPath/custom_components/hacs.zip" -d "$haPath/custom_components/hacs" >/dev/null 2>&1
info "Removing HACS zip file..."
rm "$haPath/custom_components/hacs.zip"
info "Installation complete."
echo
info "Remember to restart Home Assistant before you configure it"
for path in $(find "$haPath/custom_components" -maxdepth 1 -type f); do
error "Found a file in the custom_components directory: '$path' this should not be there and may cause issues not related to HACS but you will blame HACS so remove it!" false
done
else
echo
error "Could not find the directory for Home Assistant" false
echo "Manually change the directory to the root of your Home Assistant configuration"
echo "With the user that is running Home Assistant"
echo "and run the script again"
exit 1
fi
-
Toch wel een beetje zo aangelegd ? ;)
Bestand executable maken:
chmod 777 hacs.pl
Dan in je home directory:
./hacs.pl
-
het hacs.pl bestand staat in de home directory van home assistant (in de root dus)
Maar hoe voer ik het bestand dan uit?
Als ik gewoon ./hacs.pl krijg ik volgende melding
-
Het is mij gelukt door het command in de docker container uit te voeren.
-
Ik moest even nadenken hoe ik het ook alweer had opgelost en dit is de manier geweest. Ik heb het bash commando ingevoerd in het terminal scherm van portainer van de HA container.
@Birdy ik heb ook nog andere bezigheden dan dit forum volgen. Ik kan niet a la minuut doorgeven hoe ik het destijds heb opgelost. Bovendien moest ik dus even nadenken 😉
-
2 September had je het toch even kunnen melden? ;)
-
Als er toen iemand om had gevraagd, had ik dat ook zeker gedaan (niet a la minuut, maar wel binnen afzienbare tijd :P)
-
Oh, we moeten erom vragen, waarom zouden Forum leden wel vragen kunnen stellen, antwoorden/oplossingen verwachten en ongevraagd geen oplossingen kunnen bieden ? Snap je ?
-
Ik vraag me echt af waar je je druk om kunt maken... Wat mij betreft een slotje op dit onderwerp en weer lekker verder.
-
Kleine uitleg over de werking van een Forum, meer niet hoor 8)