mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-08-20 13:23:21 -07:00
Clean up some of the prompts for easier reading
This commit is contained in:
parent
40aff01c29
commit
c42e1cdf73
1 changed files with 17 additions and 6 deletions
|
@ -66,6 +66,7 @@ configure_plexupdate() {
|
||||||
|
|
||||||
[ -f "$CONFIGFILE" ] && source "$CONFIGFILE"
|
[ -f "$CONFIGFILE" ] && source "$CONFIGFILE"
|
||||||
|
|
||||||
|
echo
|
||||||
echo -n "Do you want to install the latest PlexPass releases? "
|
echo -n "Do you want to install the latest PlexPass releases? "
|
||||||
if yesno; then
|
if yesno; then
|
||||||
read -e -p "PlexPass Email Address: " -i "$EMAIL" EMAIL
|
read -e -p "PlexPass Email Address: " -i "$EMAIL" EMAIL
|
||||||
|
@ -76,6 +77,7 @@ configure_plexupdate() {
|
||||||
PUBLIC=yes
|
PUBLIC=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
echo -n "Would you like to automatically install the latest release when it is downloaded? "
|
echo -n "Would you like to automatically install the latest release when it is downloaded? "
|
||||||
if yesno; then
|
if yesno; then
|
||||||
AUTOINSTALL=yes
|
AUTOINSTALL=yes
|
||||||
|
@ -84,6 +86,7 @@ configure_plexupdate() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$AUTOINSTALL" == "yes" ]; then
|
if [ "$AUTOINSTALL" == "yes" ]; then
|
||||||
|
echo
|
||||||
echo -n "When using the auto-install option, would you like to check if the server is in use before upgrading? "
|
echo -n "When using the auto-install option, would you like to check if the server is in use before upgrading? "
|
||||||
if yesno; then
|
if yesno; then
|
||||||
if [ -z "$PLEXSERVER" ]; then
|
if [ -z "$PLEXSERVER" ]; then
|
||||||
|
@ -105,12 +108,14 @@ configure_plexupdate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_cron() {
|
configure_cron() {
|
||||||
|
echo
|
||||||
echo -n "Would you like to set up automatic daily updates for Plex? "
|
echo -n "Would you like to set up automatic daily updates for Plex? "
|
||||||
if yesno; then
|
if yesno; then
|
||||||
CONF="$CONFIGFILE"
|
CONF="$CONFIGFILE"
|
||||||
SCRIPT="${FULL_PATH}/plexupdate.sh"
|
SCRIPT="${FULL_PATH}/plexupdate.sh"
|
||||||
LOGGING=false
|
LOGGING=false
|
||||||
|
|
||||||
|
echo
|
||||||
echo -n "Do you want to log the daily update runs to syslog so you can examine the output later? "
|
echo -n "Do you want to log the daily update runs to syslog so you can examine the output later? "
|
||||||
if yesno; then
|
if yesno; then
|
||||||
LOGGING=true
|
LOGGING=true
|
||||||
|
@ -118,12 +123,14 @@ configure_cron() {
|
||||||
|
|
||||||
save_config "CONF SCRIPT LOGGING" "/etc/plexupdate.cron.conf"
|
save_config "CONF SCRIPT LOGGING" "/etc/plexupdate.cron.conf"
|
||||||
|
|
||||||
echo "Installing daily cron job..."
|
echo
|
||||||
|
echo -n "Installing daily cron job... "
|
||||||
if [ $EUID -ne 0 ]; then
|
if [ $EUID -ne 0 ]; then
|
||||||
sudo ln -sf ${FULL_PATH}/extras/cronwrapper /etc/cron.daily/plexupdate
|
sudo ln -sf ${FULL_PATH}/extras/cronwrapper /etc/cron.daily/plexupdate
|
||||||
else
|
else
|
||||||
ln -sf ${FULL_PATH}/extras/cronwrapper /etc/cron.daily/plexupdate
|
ln -sf ${FULL_PATH}/extras/cronwrapper /etc/cron.daily/plexupdate
|
||||||
fi
|
fi
|
||||||
|
echo "done"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +143,7 @@ save_config() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
echo "Writing configuration file '$2'..."
|
echo "Writing configuration file '$2'..."
|
||||||
if [ $EUID -ne 0 ]; then
|
if [ $EUID -ne 0 ]; then
|
||||||
# make sure that new file is owned by root instead of owner of CONFIGTEMP
|
# make sure that new file is owned by root instead of owner of CONFIGTEMP
|
||||||
|
@ -164,31 +172,34 @@ read -e -p "Directory to install into: " -i "/opt/plexupdate" FULL_PATH
|
||||||
if [ ! -d "$FULL_PATH" ]; then
|
if [ ! -d "$FULL_PATH" ]; then
|
||||||
echo -n "'$FULL_PATH' doesn't exist, attempting to create... "
|
echo -n "'$FULL_PATH' doesn't exist, attempting to create... "
|
||||||
if ! mkdir -p "$FULL_PATH" 2>/dev/null; then
|
if ! mkdir -p "$FULL_PATH" 2>/dev/null; then
|
||||||
echo "failed"
|
|
||||||
echo "trying with sudo... "
|
echo "trying with sudo... "
|
||||||
sudo mkdir -p "$FULL_PATH" || abort "failed, cannot continue"
|
sudo mkdir -p "$FULL_PATH" || abort "failed, cannot continue"
|
||||||
sudo chown $(whoami) "$FULL_PATH" || abort "failed, cannot continue"
|
sudo chown $(whoami) "$FULL_PATH" || abort "failed, cannot continue"
|
||||||
fi
|
fi
|
||||||
echo "done"
|
echo "done"
|
||||||
elif [ ! -w "$FULL_PATH" ]; then
|
elif [ ! -w "$FULL_PATH" ]; then
|
||||||
echo "'$FULL_PATH' exists, but you don't have permission to write to it. Changing owner with sudo..."
|
echo -n "'$FULL_PATH' exists, but you don't have permission to write to it. Changing owner with sudo... "
|
||||||
sudo chown $(whoami) "$FULL_PATH" || abort "failed, cannot continue"
|
sudo chown $(whoami) "$FULL_PATH" || abort "failed, cannot continue"
|
||||||
|
echo "done"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "${FULL_PATH}/.git" ]; then
|
if [ -d "${FULL_PATH}/.git" ]; then
|
||||||
cd "$FULL_PATH"
|
cd "$FULL_PATH"
|
||||||
if git remote -v | grep -q "mrworf/plexupdate"; then
|
if git remote -v | grep -q "mrworf/plexupdate"; then
|
||||||
echo "Found existing plexupdate repository in '$FULL_PATH', updating..."
|
echo -n "Found existing plexupdate repository in '$FULL_PATH', updating... "
|
||||||
git pull >/dev/null || abort "Unknown error while updating, please check '$FULL_PATH' and then try again."
|
git pull >/dev/null || abort "Unknown error while updating, please check '$FULL_PATH' and then try again."
|
||||||
else
|
else
|
||||||
abort "'$FULL_PATH' appears to contain a different git repository, cannot continue"
|
abort "'$FULL_PATH' appears to contain a different git repository, cannot continue"
|
||||||
fi
|
fi
|
||||||
|
echo "done"
|
||||||
cd - &> /dev/null
|
cd - &> /dev/null
|
||||||
else
|
else
|
||||||
git clone "$ORIGIN_REPO" "$FULL_PATH"
|
echo -n "Installing plexupdate into '$FULL_PATH'... "
|
||||||
|
git clone "$ORIGIN_REPO" "$FULL_PATH" &> /dev/null || abort "install failed, cannot continue"
|
||||||
|
echo "done"
|
||||||
# FIXME These 3 lines are just to allow us to test easily while we're still using this branch. Remember to take this out before merging to master.
|
# FIXME These 3 lines are just to allow us to test easily while we're still using this branch. Remember to take this out before merging to master.
|
||||||
cd "$FULL_PATH"
|
cd "$FULL_PATH"
|
||||||
git checkout reworklog
|
git checkout reworklog > /dev/null
|
||||||
cd - &> /dev/null
|
cd - &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue