From 3f0fa1a171bfea92de62bac8bf9e004611679ff2 Mon Sep 17 00:00:00 2001 From: gitdev-bash <63194733+gitdev-bash@users.noreply.github.com> Date: Fri, 2 Jul 2021 23:24:39 +0200 Subject: [PATCH 1/3] Add installer and update readme --- .gitignore | 2 ++ README.md | 16 +++++++++----- install.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 5 deletions(-) create mode 100755 install.sh diff --git a/.gitignore b/.gitignore index c18dd8d..2eeb18d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ __pycache__/ +Usb-Hut1_12v2.pdf +keylist-en diff --git a/README.md b/README.md index 90382ef..08d1219 100644 --- a/README.md +++ b/README.md @@ -56,15 +56,21 @@ 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 have curl -`wget -O /etc/piduck/piduck.py https://raw.githubusercontent.com/gitdev-bash/piduck/main/piduck.py` +`curl -sSL https://raw.githubusercontent.com/gitdev-bash/piduck/master/install.sh | bash` -`chmod 555 /etc/piduck/piduck.py` +#### 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) diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..6d1fc21 --- /dev/null +++ b/install.sh @@ -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 From 58040e3f085ddcb495ef9574fa672d28ffdd953a Mon Sep 17 00:00:00 2001 From: gitdev-bash <63194733+gitdev-bash@users.noreply.github.com> Date: Fri, 2 Jul 2021 23:31:23 +0200 Subject: [PATCH 2/3] add reinstall and update --- README.md | 1 + install.sh | 86 +++++++++++++++++++++++++++--------------------------- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 08d1219..bbc5171 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Press Ctrl-D to exit `reboot` reboot to activate the changes ### Install Run these as a sudo user or root! +If you want to reinstall or update piduck rerun the below script. #### if you have curl diff --git a/install.sh b/install.sh index 6d1fc21..1a7226f 100755 --- a/install.sh +++ b/install.sh @@ -13,51 +13,51 @@ then fi exit $? fi -if [[ -d "/etc/piduck" ]] +#if [[ -d "/etc/piduck" ]] +#then +# echo "Seems like piduck is already installed!" +# exit 4 +#else +if [[ "$(which git)" != "" ]] then - echo "Seems like piduck is already installed!" - exit 4 + 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 - 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 + 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 From 166330ebc3ebb98f889f20092b6198659aecfe52 Mon Sep 17 00:00:00 2001 From: gitdev-bash <63194733+gitdev-bash@users.noreply.github.com> Date: Fri, 2 Jul 2021 23:34:22 +0200 Subject: [PATCH 3/3] visual --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bbc5171..9eb2fc2 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ Press Ctrl-D to exit `reboot` reboot to activate the changes ### Install Run these as a sudo user or root! -If you want to reinstall or update piduck rerun the below script. + +**If you want to reinstall or update piduck, please rerun the script.** #### if you have curl