Skip to content

Commit 8f1fc15

Browse files
authored
FF-177 Updated Scripts, and Application (#11)
* ffighter is now installed in /usr/bin * Bumped to version v1.6, fixed main script. * Added releaseWorkflow * fixed release workflow * Added one more check, requested by @qvalentin * Added Download Script * Updated README. * Bumped version to 1.6 * fixed bug with copy pasted code.
1 parent efbaa03 commit 8f1fc15

File tree

5 files changed

+283
-103
lines changed

5 files changed

+283
-103
lines changed

.github/workflows/releaseWorkflow.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Create new Stable Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*"
7+
8+
jobs:
9+
Create-new-Release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: get version
14+
id: vars
15+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} # pls dont ask me why it has to work like this.
16+
- name: move scripts and README
17+
run: |
18+
TAG=${{ steps.vars.outputs.tag }}
19+
mkdir filefighter-$TAG
20+
mv lib filefighter-$TAG/lib
21+
mv ffighter filefighter-$TAG/ffighter
22+
mv Install.sh filefighter-$TAG/Install.sh
23+
cp README.md filefighter-$TAG/README.md
24+
mv config.cfg filefighter-$TAG/config.cfg
25+
- name: move docker-compose
26+
run: |
27+
TAG=${{ steps.vars.outputs.tag }}
28+
mkdir filefighter-$TAG-docker-compose
29+
mv docker-compose.yml filefighter-$TAG-docker-compose/docker-compose.yml
30+
cp README.md filefighter-$TAG-docker-compose/README.md
31+
- name: Create new release and tag.
32+
uses: meeDamian/[email protected]
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
tag: ${{ steps.vars.outputs.tag }}
36+
gzip: folders
37+
allow_override: true
38+
files: "filefighter-${{ steps.vars.outputs.tag }} filefighter-${{ steps.vars.outputs.tag }}-docker-compose"

Download.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
echo "Downloading FileFighter ClientSetup."
4+
curl https://codeload.github.com/FileFighter/ClientSetup/zip/master > FileFighter.zip
5+
6+
echo ""
7+
echo "finshed downloading."
8+
9+
if ! unzip >/dev/null 2>&1; then
10+
echo "'unzip' not found. Install it with 'sudo apt install unzip'."
11+
exit 1
12+
fi
13+
14+
15+
if [ ! -d "FileFighter" ]; then
16+
mkdir FileFighter
17+
fi
18+
19+
unzip FileFighter.zip -d ./FileFighter
20+
21+
echo ""
22+
echo "finished unpacking FileFighter. Installing it now..."
23+
echo ""
24+
25+
chmod -R +x FileFighter/
26+
$(pwd)/FileFighter/ClientSetup-master/Install.sh

Install.sh

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11
#!/bin/bash
2-
# TODO: update readme.
2+
3+
# Source logo and usage.
4+
source ./lib/utils.sh
5+
6+
# Move other files in this dir to /home/$USER/filefighter/
7+
SCRIPTS_LOCATION="/home/$USER/filefighter"
8+
9+
# Move ffighter to this dir.
10+
APPLICATION_LOCATION="/usr/bin"
311

412
# Read in base dir for Path.
5-
rootDir=$(realpath $0)
6-
rootDir=${rootDir/%Install.sh} # Very HACKY YES.
7-
newPATH="PATH=$PATH:$rootDir"
8-
9-
# Add main script to PATH.
10-
# Check files.
11-
profile="/home/$USER/.bash_profile"
12-
login="/home/$USER/.bash_login"
13-
rc="/home/$USER/.bashrc"
14-
15-
commandToRun=""
16-
# Checking command.
17-
ffighter >/dev/null 2>&1
18-
19-
if [ $? == 127 ]; then # command does not exist add it to path
20-
echo "Adding FileFighter Application to PATH..."
21-
if [[ -f "$profile" ]]; then
22-
echo "$newPATH" >>"$profile"
23-
commandToRun="source $profile"
24-
elif [[ -f "$login" ]]; then
25-
echo "$newPATH" >>"$login"
26-
commandToRun="source $login"
27-
elif [[ -f "$rc" ]]; then
28-
echo "$newPATH" >>"$rc"
29-
commandToRun="source $rc"
30-
else
31-
echo "Couldn't add FileFighter Application to PATH. Please contact us at [email protected]."
32-
echo "Or add following line to your PATH variable:"
33-
echo "$rootDir"
34-
exit 1
35-
fi
36-
37-
echo "Adding FileFighter Application to PATH was successful."
38-
echo "Please run the following command to finish the installation."
39-
echo ""
40-
echo $commandToRun
41-
else
42-
echo "FileFighter Application already available"
43-
echo "Use: ffighter <args>."
13+
DOWNLOAD_LOCATION=$(realpath $0)
14+
DOWNLOAD_LOCATION=${DOWNLOAD_LOCATION/%Install.sh} # Very HACKY YES.
15+
16+
VERSION="v1.6"
17+
DATE="24.01.21"
18+
19+
echoLogo $VERSION $DATE "Initial Install"
20+
21+
if [ ! -d "/home/$USER" ]; then
22+
echo "Home directory for the current user not found. If you are root, switch to a user with a directory under /home/"
23+
exit 1
4424
fi
25+
26+
if [ ! -d $SCRIPTS_LOCATION ]; then
27+
echo "Creating Install Location under $SCRIPTS_LOCATION"
28+
mkdir $SCRIPTS_LOCATION
29+
fi
30+
31+
echo "Copying Scripts to new location..."
32+
cd $DOWNLOAD_LOCATION
33+
cp -r . $SCRIPTS_LOCATION
34+
35+
echo "Copying FileFighter Application to $APPLICATION_LOCATION..."
36+
echo "This may need administrator rights (sudo) if you are not root."
37+
sudo cp $DOWNLOAD_LOCATION/ffighter $APPLICATION_LOCATION
38+
39+
echo ""
40+
echo "Successfully installed FileFighter!"
41+
echo "You can delete the downloaded files ($DOWNLOAD_LOCATION) if you want."
42+
echo ""
43+
printUsage

0 commit comments

Comments
 (0)