-
-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from nextcloud/master
[WIP] Create Passman script (#102)
- Loading branch information
Showing
1 changed file
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,51 @@ | ||
#!/bin/bash | ||
|
||
# We will develop this when Passman is production ready | ||
# https://github.com/nextcloud/passman | ||
# Variables | ||
HTML=/var/www | ||
NCPATH=$HTML/nextcloud | ||
SCRIPTS=/var/scripts | ||
PASSVER=$(curl -s https://api.github.com/repos/nextcloud/passman/releases/latest | grep "tag_name" | cut -d\" -f4) | ||
PASSVER_FILE=passman_$PASSVER.tar.gz | ||
PASSVER_REPO=https://releases.passman.cc | ||
|
||
echo "The passman script is not yet developed..." | ||
# Check if root | ||
if [ "$(whoami)" != "root" ] | ||
then | ||
echo | ||
echo -e "\e[31mSorry, you are not root.\n\e[0mYou must type: \e[36msudo \e[0mbash $SCRIPTS/passman.sh" | ||
echo | ||
exit 1 | ||
fi | ||
|
||
# Check if file is downloadable | ||
echo "Checking latest released version on the Passman download server and if it's possible to download..." | ||
curl -s wget -q $PASSVER_REPO/$PASSVER/$PASSVER_FILE > /dev/null | ||
if [ $? -eq 0 ] | ||
then | ||
echo "Latest version is: $PASSVER" | ||
else | ||
echo "Failed! Download is not available at the moment, try again later." | ||
sleep 3 | ||
exit 1 | ||
fi | ||
|
||
# Download and install Passman | ||
if [ -d $NCPATH/apps/passman ] | ||
then | ||
sleep 1 | ||
else | ||
wget -q $PASSVER_REPO/$PASSVER_FILE -P $NCPATH/apps | ||
tar -zxf $NCPATH/apps/$PASSVER_FILE -C $NCPATH/apps | ||
cd $NCPATH/apps | ||
rm $PASSVER_FILE | ||
fi | ||
|
||
# Enable Passman | ||
if [ -d $NCPATH/apps/passman ] | ||
then | ||
sudo -u www-data php $NCPATH/occ app:enable passman | ||
sleep 2 | ||
else | ||
echo "Something went wrong with the installation, Passman couln't be activated..." | ||
exit 1 | ||
fi |