#!/bin/bash

URL_PREFIX="https://documentation-samples.obs.cn-north-4.myhuaweicloud.com/solution-as-code-publicbucket/solution-as-code-moudle/deploying-clawdbot-agents/userdata/dify/"

if [ -d "/home/openclaw" ]; then
    FILE="/home/openclaw/.openclaw/skills/$1/SKILL.md"
    if [ ! -f $FILE ]; then
        sudo -i -u openclaw mkdir -p /home/openclaw/.openclaw/skills/$1
        sudo -i -u openclaw wget -O $FILE "${URL_PREFIX}$1.md"
    fi
else
    FILE="/root/.openclaw/skills/$1/SKILL.md"
    if [ ! -f $FILE ]; then
        mkdir -p /root/.openclaw/skills/$1
        wget -O $FILE "${URL_PREFIX}$1.md"
    fi
fi
