File size: 1,929 Bytes
7741f2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash

# Download defaults.json from the given URL and save as "defaults.json"
curl -o defaults.json https://raw.githubusercontent.com/shubhamakshit/pwdlv3/main/defaults.linux.json

# Ensure pip is installed by downloading and running get-pip.py
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python_installed=false

# get architecture and os
# supported (linux64 , linuxarm, androidaarch64)


if command -v python &> /dev/null
then
    python_installed=true
    echo "Python is installed"
    python get-pip.py --break-system-packages
    python -m pip install -r requirements.txt --break-system-packages
elif command -v python3 &> /dev/null
then
    python_installed=true
    echo "Python3 is installed"
    python3 get-pip.py --break-system-packages
    python3 -m pip install -r requirements.txt --break-system-packages
else
    echo "Python is not installed"
    # exit if python is not installed
    exit 1
fi

# Clean up get-pip.py
rm get-pip.py

# Get the absolute path of the script's directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

arch=$(uname -m)
os=$(uname -o)
mp4decrypt_url="https://raw.githubusercontent.com/shubhamakshit/pwdlv3_assets/main/$os/$arch/mp4decrypt"
vsd_url="https://raw.githubusercontent.com/shubhamakshit/pwdlv3_assets/main/$os/$arch/vsd"

# download mp4decrypt and vsd to bin
mkdir -p $SCRIPT_DIR/bin
curl -o $SCRIPT_DIR/bin/mp4decrypt $mp4decrypt_url
curl -o $SCRIPT_DIR/bin/vsd $vsd_url
chmod +x $SCRIPT_DIR/bin/*

# Check if 'alias pwdl' is already present in ~/.bashrc
if ! grep -q "alias pwdl" ~/.bashrc
then
    # Add alias to ~/.bashrc
    echo "alias pwdl='python3 $SCRIPT_DIR/pwdl.py'" >> ~/.bashrc
fi

# Source ~/.bashrc to make the alias available in the current session
source ~/.bashrc

# Notify the user to restart their terminal to apply the alias if not sourced
echo "Please restart your terminal or run 'source ~/.bashrc' to apply the alias."