Compare commits

..

No commits in common. "b0c32c4e47c214890362b15f8c8b84e5d462cc1f" and "8bc37d93b7636ea408a1ae7653f023d3eadfe0c5" have entirely different histories.

2 changed files with 30 additions and 40 deletions

View File

@ -11,9 +11,6 @@
- **Proxmox VE LXC Updater**
- Now displays which containers require a reboot.
- **File Browser**
- Uninstall by re-executing the script
- Option to use No Authentication
## 2023-10-05

View File

@ -6,7 +6,6 @@
# https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info {
clear
cat <<"EOF"
_______ __ ____
/ ____(_) /__ / __ )_________ _ __________ _____
@ -29,21 +28,24 @@ HOLD="-"
CM="${GN}${CL}"
APP="FileBrowser"
hostname="$(hostname)"
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
shopt -s expand_aliases
alias die='EXIT=$? LINE=$LINENO error_exit'
trap die ERR
function error_exit() {
trap - ERR
local reason="Unknown failure occured."
local msg="${1:-$reason}"
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
echo -e "$flag $msg" 1>&2
exit $EXIT
}
clear
header_info
if [ -f /root/filebrowser.db ]; then
read -r -p "Would you like to uninstall ${APP} on $hostname.? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
systemctl disable -q --now filebrowser.service
rm -rf /usr/local/bin/filebrowser /root/filebrowser.db /etc/systemd/system/filebrowser.service
echo "$APP Removed"
sleep 2
clear
exit
else
clear
exit
fi
fi
while true; do
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
case $yn in
@ -52,6 +54,7 @@ while true; do
*) echo "Please answer yes or no." ;;
esac
done
clear
header_info
function msg_info() {
local msg="$1"
@ -63,27 +66,17 @@ function msg_ok() {
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
read -r -p "Would you like to use No Authentication? <y/N> " prompt
msg_info "Installing ${APP}"
RELEASE=$(curl -fsSL https://api.github.com/repos/filebrowser/filebrowser/releases/latest | grep -o '"tag_name": ".*"' | sed 's/"//g' | sed 's/tag_name: //g')
curl -fsSL https://github.com/filebrowser/filebrowser/releases/download/$RELEASE/linux-amd64-filebrowser.tar.gz | tar -xzv -C /usr/local/bin &>/dev/null
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
filebrowser config init -a '0.0.0.0' &>/dev/null
filebrowser config set -a '0.0.0.0' &>/dev/null
filebrowser config init --auth.method=noauth &>/dev/null
filebrowser config set --auth.method=noauth &>/dev/null
filebrowser users add ID 1 --perm.admin &>/dev/null
else
filebrowser config init -a '0.0.0.0' &>/dev/null
filebrowser config set -a '0.0.0.0' &>/dev/null
filebrowser users add admin changeme --perm.admin &>/dev/null
fi
msg_ok "Installed ${APP} on $hostname"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/filebrowser.service
[Unit]
service_path="/etc/systemd/system/filebrowser.service"
echo "[Unit]
Description=Filebrowser
After=network-online.target
@ -93,9 +86,9 @@ WorkingDirectory=/root/
ExecStart=/usr/local/bin/filebrowser -r /
[Install]
WantedBy=default.target
EOF
systemctl enable -q --now filebrowser.service
WantedBy=default.target" >$service_path
systemctl enable --now filebrowser.service &>/dev/null
msg_ok "Created Service"
msg_ok "Completed Successfully!\n"