diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..893b107 --- /dev/null +++ b/install.ps1 @@ -0,0 +1,27 @@ +# Define URL for GeckoDriver +$geckoURL = "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-win64.zip" + +# Define target directories for installation +$geckoDir = "$env:USERPROFILE\facebook-downloader\GeckoDriver" + +# Function to download a file +function DownloadFile([string]$url, [string]$path) { + Invoke-WebRequest -Uri $url -OutFile $path +} + +# Check if GeckoDriver directory exists, if not create and download +if (-Not (Test-Path $geckoDir)) { + New-Item -Path $geckoDir -ItemType Directory + Write-Host "Downloading GeckoDriver..." + DownloadFile $geckoURL "$geckoDir\geckodriver.zip" + + # Unzipping the GeckoDriver + Expand-Archive -Path "$geckoDir\geckodriver.zip" -DestinationPath $geckoDir + Remove-Item "$geckoDir\geckodriver.zip" +} + +# Add the geckodriver directory to PATH +[Environment]::SetEnvironmentVariable("PATH", [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User) + ";$geckoDir", [EnvironmentVariableTarget]::User) + +pip install . +Write-Host "Setup complete." diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..6034c46 --- /dev/null +++ b/install.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Download geckodriver .tar.gz file and pipe it to 'tar' to extract the geckodriver binary directly into /usr/bin. +curl -L https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz | \ + tar xz -C /usr/bin + +# Install Python packages defined in the current directory's setup.py/pyproject.toml file. (pyproject.toml in this case) +pip3 install . +echo "Setup complete." \ No newline at end of file diff --git a/uninstall.ps1 b/uninstall.ps1 new file mode 100644 index 0000000..6bf1e9f --- /dev/null +++ b/uninstall.ps1 @@ -0,0 +1,26 @@ +# Define target directory for removal +$geckoDir = "$env:USERPROFILE\facebook-downloader\GeckoDriver" + +# Function to remove directory +function RemoveDir([string]$dirPath) { + if (Test-Path $dirPath) { + Remove-Item -Path $dirPath -Recurse -Force + Write-Host "Removed directory: $dirPath" + } else { + Write-Host "Directory $dirPath does not exist." + } +} + +# Remove GeckoDriver directory +RemoveDir $geckoDir + +# Remove the geckodriver directory from PATH +$pathEnv = [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User) +$newPath = ($pathEnv -split ";" | Where-Object { $_ -ne $geckoDir }) -join ";" +[Environment]::SetEnvironmentVariable("PATH", $newPath, [EnvironmentVariableTarget]::User) +Write-Host "Removed GeckoDriver directory from PATH." + +# Uninstall facebook-downloader Python package +pip uninstall facebook-downloader -y + +Write-Host "Cleanup complete." diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..f917a16 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Remove the geckodriver binary from /usr/bin +sudo rm /usr/bin/geckodriver -v + +# Uninstall tor2tor +pip3 uninstall facebook-downloader -y -v +echo "Cleanup complete." \ No newline at end of file