mirror of https://github.com/tteck/Proxmox
parent
53b24ef7b7
commit
eec4793514
2 changed files with 170 additions and 0 deletions
@ -0,0 +1,102 @@ |
||||
#!/usr/bin/env bash |
||||
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) |
||||
# Copyright (c) 2021-2024 tteck |
||||
# Author: tteck (tteckster) |
||||
# Co-Author: ulmentflam |
||||
# License: MIT |
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE |
||||
|
||||
function header_info { |
||||
clear |
||||
cat <<"EOF" |
||||
______ |
||||
/ ____/___ ____ ____ _______ _______ |
||||
/ /_ / __ \/ __ \/ __ \/ ___/ / / / ___/ |
||||
/ __/ / /_/ / /_/ / /_/ / /__/ /_/ (__ ) |
||||
/_/ \____/\____/\____/\___/\__,_/____/ |
||||
|
||||
EOF |
||||
} |
||||
header_info |
||||
echo -e "Loading..." |
||||
APP="Fooocus" |
||||
var_disk="4" |
||||
var_cpu="2" |
||||
var_ram="2048" |
||||
var_os="debian" |
||||
var_version="12" |
||||
variables |
||||
color |
||||
catch_errors |
||||
|
||||
function default_settings() { |
||||
CT_TYPE="1" |
||||
PW="" |
||||
CT_ID=$NEXTID |
||||
HN=$NSAPP |
||||
DISK_SIZE="$var_disk" |
||||
CORE_COUNT="$var_cpu" |
||||
RAM_SIZE="$var_ram" |
||||
BRG="vmbr0" |
||||
NET="dhcp" |
||||
GATE="" |
||||
APT_CACHER="" |
||||
APT_CACHER_IP="" |
||||
DISABLEIP6="no" |
||||
MTU="" |
||||
SD="" |
||||
NS="" |
||||
MAC="" |
||||
VLAN="" |
||||
SSH="no" |
||||
VERB="no" |
||||
echo_default |
||||
} |
||||
|
||||
function update_script() { |
||||
header_info |
||||
if [[ ! -f /etc/systemd/system/fooocus.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi |
||||
msg_info "Updating $APP LXC" |
||||
apt-get update &>/dev/null |
||||
|
||||
RELEASE=$(curl -s https://api.github.com/repos/lllyasviel/Fooocus/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') |
||||
|
||||
if [[ -z "$RELEASE" ]]; then |
||||
msg_error "Failed to get latest version" |
||||
exit |
||||
fi |
||||
|
||||
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \ |
||||
"1" "Update Fooocus to $RELEASE" ON \ |
||||
3>&1 1>&2 2>&3) |
||||
header_info |
||||
if [ "$UPD" == "1" ]; then |
||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then |
||||
msg_info "Updating $APP to $RELEASE" |
||||
systemctl stop fooocus.service |
||||
cd ~ || msg_error "Failed to change directory" |
||||
wget -q https://github.com/lllyasviel/Fooocus/archive/refs/tags/${RELEASE}.tar.gz |
||||
# shellcheck disable=SC2086 |
||||
tar -xf ${RELEASE}.tar.gz |
||||
cp -r "${RELEASE}"/* /opt/Fooocus |
||||
rm -rf "${RELEASE}" "${RELEASE}".tar.gz |
||||
cd /opt/Fooocus || msg_error "Failed to change directory" |
||||
pip3 install --upgrade pip |
||||
pip3 install -r requirements_versions.txt |
||||
echo "$RELEASE" > /opt/${APP}_version.txt |
||||
systemctl start fooocus.service |
||||
msg_ok "Updated $APP LXC" |
||||
else |
||||
msg_warn "Already on latest version" |
||||
fi |
||||
fi |
||||
exit |
||||
} |
||||
|
||||
start |
||||
build_container |
||||
description |
||||
|
||||
msg_ok "Completed Successfully!\n" |
||||
echo -e "${APP} should be reachable by going to the following URL. |
||||
${BL}http://${IP}:80${CL} \n" |
@ -0,0 +1,68 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
# Copyright (c) 2021-2024 tteck |
||||
# Author: tteck (tteckster) |
||||
# License: MIT |
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE |
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" |
||||
color |
||||
verb_ip6 |
||||
catch_errors |
||||
setting_up_container |
||||
network_check |
||||
update_os |
||||
|
||||
msg_info "Installing Dependencies" |
||||
$STD apt-get install -y curl |
||||
$STD apt-get install -y sudo |
||||
$STD apt-get install -y mc |
||||
msg_ok "Installed Dependencies" |
||||
|
||||
msg_info "Updating Python3" |
||||
$STD apt-get install -y \ |
||||
python3 \ |
||||
python3-dev \ |
||||
python3-pip \ |
||||
python3-setuptools \ |
||||
python3-wheel |
||||
msg_ok "Updated Python3" |
||||
|
||||
msg_info "Installing Fooocus" |
||||
FOOOCUS_VERSION=$(wget -q https://github.com/lllyasviel/Fooocus/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) |
||||
cd /opt || msg_error "Failed to change directory to /opt" |
||||
$STD wget https://github.com/lllyasviel/Fooocus/releases/download/"$FOOOCUS_VERSION"/"$FOOOCUS_VERSION".tar.xz |
||||
$STD tar -xf "${FOOOCUS_VERSION}".tar.xz -C /opt/ |
||||
mv "${FOOOCUS_VERSION}" /opt/Fooocus |
||||
rm -rf "${FOOOCUS_VERSION}" "${FOOOCUS_VERSION}".tar.xz |
||||
cd /opt/Fooocus || msg_error "Failed to change directory to /opt/Fooocus" |
||||
$STD pip3 install --upgrade pip |
||||
$STD pip3 install -r requirements.txt |
||||
echo "${FOOOCUS_VERSION}" >/opt/Fooocus_version.txt |
||||
msg_ok "Installed Fooocus" |
||||
|
||||
msg_info "Creating Service" |
||||
service_path="/etc/systemd/system/fooocus.service" |
||||
echo "[Unit] |
||||
Description=Fooocus Image Generation Service |
||||
After=network-online.target |
||||
|
||||
[Service] |
||||
Type=simple |
||||
UMask=007 |
||||
ExecStart=/usr/bin/python3 /opt/Fooocus/entry_with_update.py --listen |
||||
Restart=on-failure |
||||
TimeoutStopSec=300 |
||||
|
||||
[Install] |
||||
WantedBy=multi-user.target" >$service_path |
||||
systemctl enable --now -q fooocus.service |
||||
msg_ok "Created Service" |
||||
|
||||
motd_ssh |
||||
customize |
||||
|
||||
msg_info "Cleaning up" |
||||
$STD apt-get -y autoremove |
||||
$STD apt-get -y autoclean |
||||
msg_ok "Cleaned" |
Loading…
Reference in new issue