Skip to content

Add installer #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
__pycache__/
Usb-Hut1_12v2.pdf
keylist-en
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,23 @@ ls /sys/class/udc > UDC
Press Ctrl-D to exit
`reboot` reboot to activate the changes
### Install
Also run these commands as root!
Run these as a sudo user or root!

`mkdir /etc/piduck`
**If you want to reinstall or update piduck, please rerun the script.**

`wget -O /etc/piduck/piduck.py https://raw.githubusercontent.com/gitdev-bash/piduck/main/piduck.py`
#### if you have curl

`chmod 555 /etc/piduck/piduck.py`
`curl -sSL https://raw.githubusercontent.com/gitdev-bash/piduck/master/install.sh | bash`

#### if you have wget

`wget -q -O - https://raw.githubusercontent.com/gitdev-bash/piduck/master/install.sh | bash`

#### If you already have it locally

`chmod 755 install.sh`
`./install.sh`

`ln -s /etc/piduck/piduck.py /usr/bin/piduck`
## Usage
Syntax of [Ducky-Script-v1][Ducky-Script-v1-Syntax]
Root is needed (again)
Expand Down
63 changes: 63 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -e
if [ "$EUID" == "0" ]
then
echo "Running as root"
elif [[ "$(which sudo)" != "" ]]
then
echo "Running as sudo"
if [[ "$0" == "bash" ]]; then
exec curl -sSL https://raw.githubusercontent.com/gitdev-bash/piduck/master/install.sh | sudo bash "$@"
else
exec sudo bash "$0" "$@"
fi
exit $?
fi
#if [[ -d "/etc/piduck" ]]
#then
# echo "Seems like piduck is already installed!"
# exit 4
#else
if [[ "$(which git)" != "" ]]
then
echo "Using git!"
git clone https://github.com/gitdev-bash/piduck.git /tmp/piduck
elif [[ "$(which wget)" != "" && "$(which unzip)" != "" ]]
then
echo "Using wget and unzip"
wget -q -O /tmp/piduck.zip https://github.com/gitdev-bash/piduck/zipball/master/
unzip /tmp/piduck.zip
rm /tmp/piduck.zip
elif [[ "$(which curl)" != "" && "$(which unzip)" != "" ]]
then
echo "Using curl and unzip"
curl -sSL -o /tmp/piduck.zip https://github.com/gitdev-bash/piduck/zipball/master/
unzip /tmp/piduck.zip
rm /tmp/piduck.zip
elif [[ "$(which wget)" != "" && "$(which gunzip)" != "" ]]
then
echo "Using wget and gunzip"
wget -q -O /tmp/piduck.zip https://github.com/gitdev-bash/piduck/tarball/master/
tar -xzvf /tmp/piduck.tar.gz
rm /tmp/piduck.tar.gz
elif [[ "$(which curl)" != "" && "$(which gunzip)" != "" ]]
then
echo "Using curl and gunzip"
curl -sSL -o /tmp/piduck.zip https://github.com/gitdev-bash/piduck/tarball/master/
tar -xzvf /tmp/piduck.tar.gz
rm /tmp/piduck.tar.gz
else
echo "Ops missing dependencies"
exit 2
fi
mkdir /etc/piduck
mv /tmp/piduck/piduck.py /etc/piduck/piduck.py
mv /tmp/piduck/pd_key_maps /etc/piduck/pd_key_maps
mv /tmp/piduck/requirements.txt /etc/piduck/requirements.txt
chmod 555 /etc/piduck/piduck.py /etc/piduck/pd_key_maps/*
chmod 444 /etc/piduck/pd_key_maps/* /etc/piduck/requirements.txt
rm -rf /tmp/piduck
ln -s /etc/piduck/piduck.py /usr/bin/piduck
#fi
echo "DONE!"
exit 0