Compare commits

...

20 Commits

Author SHA1 Message Date
f55fa43175 Remove obsolete scripts 2020-07-08 23:36:47 -07:00
f419fbf5b3 Remove: loadsshkeys.sh: no longer required 2020-07-08 23:24:44 -07:00
52fde23819 fallocate is no longer a viable option, use dd 2020-07-08 23:20:28 -07:00
f597d1285f doppler.sh: -ft opens forecast in stand alone terminal 2020-06-17 10:55:49 -07:00
2242818f97 doppler.sh: make radar image var more descriptive 2020-06-17 08:50:19 -07:00
6a6616cfbc doppler.sh: add forecast options, clean code 2020-06-17 08:48:38 -07:00
167eaf8c95 New Script: doppler.sh: check local radar map 2020-06-17 06:14:34 -07:00
a67d23f6cf Merge branch 'master' of gitea:mollusk/jitty-scripts 2020-06-17 00:45:17 -07:00
4f3d6ca96f New Script: dino-git.sh: build git version of dino XMPP client 2020-06-17 00:43:30 -07:00
aef1d2d10f auto-ping.sh: rename to aping.sh 2020-05-03 09:20:12 -07:00
6f24ce861c auto-ping.sh: clarify ping message 2020-05-03 09:19:11 -07:00
720e2a2ad3 Merge branch 'master' of origin 2020-04-30 10:52:20 -07:00
eb593f4df7 rtlwifi-setup.sh: use newer repo 2020-04-30 10:51:45 -07:00
faeb58e3d4 nmip.sh: change logic 2020-04-14 09:40:17 -07:00
562ad079ea add todos 2020-04-10 12:35:07 -07:00
9687642456 Merge branch 'master' of gitea:mollusk/jitty-scripts 2020-03-31 08:47:42 -07:00
ad4e548f25 Add todo file 2020-03-31 08:30:46 -07:00
38ef6ec0a3 svc.sh: change unenable to disable 2020-02-28 12:58:55 -07:00
5b91f75118 Remove endless sky save file 2020-02-23 18:11:33 -07:00
38ac94ceaa New File: Endless Sky game save 2020-02-21 14:25:58 -07:00
20 changed files with 183 additions and 658 deletions

46
.todo2 Normal file
View File

@@ -0,0 +1,46 @@
{
"title": "",
"tasks": [
{
"text": "Clean dishes in sink",
"priority": "veryhigh",
"creation": 1585609661,
"completion": 1585675940
},
{
"text": "Cancel duolingo subscription before April 2nd",
"priority": "veryhigh",
"creation": 1585614956
},
{
"text": "Write post on Nim forums about Space Nim",
"priority": "medium",
"creation": 1585117484
},
{
"text": "find radio chargers",
"priority": "low",
"creation": 1585609589
},
{
"text": "work on old computer from Lee",
"priority": "low",
"creation": 1585609627
},
{
"text": "set up joplin on Lindsay's computer",
"priority": "low",
"creation": 1585609744
},
{
"text": "get smokes",
"priority": "medium",
"creation": 1585667890
},
{
"text": "Fix Jsearch",
"priority": "medium",
"creation": 1585671336
}
]
}

45
.todo2~ Normal file
View File

@@ -0,0 +1,45 @@
{
"title": "",
"tasks": [
{
"text": "Clean dishes in sink",
"priority": "veryhigh",
"creation": 1585609661
},
{
"text": "Cancel duolingo subscription before April 2nd",
"priority": "veryhigh",
"creation": 1585614956
},
{
"text": "Write post on Nim forums about Space Nim",
"priority": "medium",
"creation": 1585117484
},
{
"text": "find radio chargers",
"priority": "low",
"creation": 1585609589
},
{
"text": "work on old computer from Lee",
"priority": "low",
"creation": 1585609627
},
{
"text": "set up joplin on Lindsay's computer",
"priority": "low",
"creation": 1585609744
},
{
"text": "get smokes",
"priority": "medium",
"creation": 1585667890
},
{
"text": "Fix Jsearch",
"priority": "medium",
"creation": 1585671336
}
]
}

View File

@@ -31,7 +31,7 @@ withLoop(){
clear
echo
echo "Pinging: ${site}"
echo "Pinging ${site} until a connection is reached"
${pingcmd} ${site} &>/dev/null
if [ $? = "2" ];then
echo

37
dino-git.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
GIT_URL="https://github.com/dino/dino.git"
MASTER_DIR="dino"
BUILD_DIR="build"
if [[ -z "${1}" ]];then
echo "Please specify how many threads you want the make command to use (starting from 0)"
echo "Example: ${0} 5"
echo "The above example will use 4 threads"
exit 0
fi
echo "getting dependencies..."
if [[ -f /usr/bin/apt ]];then
sudo apt install cmake valac libgee-0.8-dev libsqlite3-dev libgtk-3-dev libnotify-dev libgpgme-dev libsoup2.4-dev libgcrypt20-dev libqrencode-dev gettext libsignal-protocol-c-dev
elif [[ -f /usr/bin/dnf ]];then
sudo dnf install cmake vala libgee-devel gtk3-devel libgcrypt-devel qrencode-devel gdk-pixbuf2-devel libsoup-devel gpgme-devel libsignal-protocol-c-devel
else
echo "Package manager not detected"
fi
if [[ ! -d "${MASTER_DIR}" ]];then
git clone ${GIT_URL}
cd ${MASTER_DIR}
./configure
make -j${1}
if [[ ! -f "${BUILD_DIR}/dino" ]];then
echo "The build failed, since the ${BUILD_DIR} is missing"
exit 1
else
echo "You can now run the binary located in $(pwd)/${BUILD_DIR}"
fi
else echo "${MASTER_DIR} directory exists already"
fi

45
doppler.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
# doppler.sh
RADAR_IMAGE_URL="https://radar.weather.gov/lite/N0R/FSX_loop.gif"
VIDEO_PLAYER=/usr/bin/mpv
LINK_DOWNLOADER=/usr/bin/curl
FORECAST_URL="wttr.in"
TERMINAL_APP=/usr/bin/xterm
TERMINAL_OPTS="-maximized -hold -e"
if [[ ! -f "${VIDEO_PLAYER}" ]];then
echo "${VIDEO_PLAYER} not found"
echo "Please install it with your system's package manager"
notify-send "${VIDEO_PLAYER} not found" "Please install it with your system's package manager"
exit 1
fi
if [[ ! -f "${LINK_DOWNLOADER}" ]];then
echo "${VIDEO_PLAYER} not found"
echo "Please install it with your system's package manager"
notify-send "${VIDEO_PLAYER} not found" "Please install it with your system's package manager"
exit 1
fi
case "${1}" in
-f | forecast)
echo "Getting forecast from ${FORECAST_URL}..."
${LINK_DOWNLOADER} ${FORECAST_URL}
;;
-ft | forecast-terminal)
notify-send "Getting forecast from ${FORECAST_URL}..."
${TERMINAL_APP} ${TERMINAL_OPTS} ${LINK_DOWNLOADER} ${FORECAST_URL}
;;
-h | help | --help)
echo -e "\nUsage: ${0} [-f | forecast ], [-ft, forecast-terminal], [-h, help, --help]\n"
;;
*)
notify-send "Getting radar image" "please wait..."
${VIDEO_PLAYER} --loop=inf "${RADAR_IMAGE_URL}"
;;
esac

View File

@@ -1,19 +0,0 @@
#!/bin/bash
testingpoo(){
if [ $1 -gt $2 ];then
echo "$1 is greater than $2"
elif [ $1 -lt $2 ];then
echo "$1 is less than $2"
elif [ $1 -eq $2 ];then
echo "$1 is equal to $2"
else
echo "Fuck you"
fi
}
testingpoo $1 $2

View File

@@ -41,8 +41,8 @@ function autoSwap(){
echo -e "${LGREEN}------------------------------------------------------------------${NC}"
read
echo -e "${LCYAN}\nCreating file in ${SWAPPATH}...\n${NC}"
fallocate -l ${TOTALRAM}M ${SWAPPATH}${SWAPNAME}
echo -e "${LCYAN}\nCreating file ${SWAPPATH}/${SWAPNAME}...\n${NC}"
dd if=/dev/zero of=${SWAPPATH}${SWAPNAME} count=${TOTALRAM} bs=1MiB
ls -lh ${SWAPPATH}${SWAPNAME}
sleep 1

View File

@@ -1,36 +0,0 @@
#!/bin/bash
appname="LBRY"
version="0.15.0"
arch="amd64"
url="https://github.com/lbryio/lbry-app/releases/download/v${version}/${appname}_${version}_${arch}.deb"
depends="gnome-keyring nodejs npm binutils xz"
tmpdir="/tmp"
output_file="lbry.deb"
desc="Content distribution platform using blockchain technology"
fetch_deps(){
sudo dnf install ${depends}
}
fetch_url(){
if [ ! -f ${tmpdir}/${output_file} ];then
wget -O ${tmpdir}/${output_file} ${url}
fi
}
extract_file(){
cd ${tmpdir}
sudo ar x ${output_file} data.tar.xz
sudo tar xvf data.tar.xz
}
install(){
sudo cp -rv ${tmpdir}/usr/* /usr/
sudo cp -rv ${tmpdir}/opt/* /opt/
}
fetch_deps
fetch_url
extract_file
install

View File

@@ -1,56 +0,0 @@
#!/bin/bash
GITBUCKETPATH="/home/mollusk/.gitbucket"
WARFILE="gitbucket.war"
LIBNOTIFY="true"
LOGDIR="/tmp"
LOGFILE="gitbucket.log"
CheckNotify()
{
if [ "${LIBNOTIFY}" = "true" ];then
notify-send "$1"
elif [ "${LIBNOTIFY}" = "false" ];then
"$1" &> /dev/null
echo "$(date +"%T"): [INFO]: libnotify support disabled" >> ${LOGDIR}/${LOGFILE}
else
echo "[ATTENTION]: Please check the logs: /tmp/gitbucket.log"
echo "$(date +"%T"): [WARNING]: LIBNOTIFY setting is invalid" >> ${LOGDIR}/${LOGFILE}
fi
}
case "$1" in
start) nohup java -jar ${GITBUCKETPATH}/${WARFILE} &> /dev/null &
sleep 1
PID=$(pidof java)
if [ "${PID}" ];then
CheckNotify "Gitbucket started on PID: ${PID}"
echo "Gitbucket started on PID: ${PID}"
else
CheckNotify "Gitbucket Failed to start!"
echo "Gitbucket process failed to start!"
fi
;;
stop) killall java
sleep 1
if [ ! "${PID}" ];then
CheckNotify "Gitbucket was terminated"
echo "Gitbucket was terminated"
else
CheckNotify "There was a problem terminating Gitbucket"
echo "There was a problem terminating Gitbucket"
fi
;;
open) xdg-open "http://localhost:8080" &> /dev/null
;;
status) ps -fC java
;;
esac

112
goup.sh
View File

@@ -1,112 +0,0 @@
#!/bin/bash
case ${1} in
--set-version)
version="${2}"
;;
*)
pkgname="go"
version="1.9.1"
distfile="https://storage.googleapis.com/golang/${pkgname}${version}.linux-amd64.tar.gz"
tmpdir="/tmp"
installdir="/usr/local"
checksum=d70eadefce8e160638a9a6db97f7192d8463069ab33138893ad3bf31b0650a79
# Colors
RED='\033[0;31m'
LRED="\033[1;31m"
BLUE="\033[0;34m"
LBLUE="\033[1;34m"
GREEN="\033[0;32m"
LGREEN="\033[1;32m"
YELLOW="\033[1;33m"
CYAN="\033[0;36m"
LCYAN="\033[1;36m"
PURPLE="\033[0;35m"
LPURPLE="\033[1;35m"
BWHITE="\e[1m"
NC='\033[0m' # No Color
fetch_(){
printf "${BWHITE}\nFetching file\n${NC}"
cd ${tmpdir}
if [ ! -f ${pkgname}${version}.linux-amd64.tar.gz ];then
wget ${distfile}
fi
printf "${BWHITE}\nVerifying checksum\n${NC}"
if [ ! -f checksum.txt ];then
echo "${checksum} ${pkgname}${version}.linux-amd64.tar.gz" >> checksum.txt
sha256sum -c checksum.txt
else
sha256sum -c checksum.txt
fi
if [ $? = 1 ];then
exit 0;
fi
}
extract-install_(){
cd ${tmpdir}
if [ ! -f ${pkgname}${version}.linux-amd64.tar.gz ];then
echo "No file found to extract"
else
printf "${BWHITE}\nExtracting and installing to:${NC} " && printf "${LCYAN}${installdir}\n${NC}"
printf "${LRED}\nAuthentication for root:${NC}\n" && su -c "tar -C ${installdir} -xzvf ${pkgname}${version}.linux-amd64.tar.gz"
fi
if [ ! -d /usr/local/go ];then
echo -e "\nCan not find ${pkgname} in ${installdir}\n"
exit 0;
else
echo -e "${LGREEN}\n${pkgname}-${version} has been installed to ${installdir}${NC}"
fi
}
add-path_(){
echo -e "\n1. Add gopath to ${HOME}/.profile\n"
echo -e "\n2. Add gopath to ${HOME}/.bashrc\n"
read choice
if [ "${choice}" = "1" ];then
echo 'export PATH=$PATH:/usr/local/go/bin' >> ${HOME}/.profile
elif [ "${choice}" = "2" ];then
printf "${BWHITE}\nAdding gopath to .bashrc${NC}"
echo 'export PATH=$PATH:/usr/local/go/bin' >> ${HOME}/.bashrc
catpath=$(cat ${HOME}/.bashrc | grep /usr/local/go/bin)
${catpath}
if [ $? = 1 ];then
printf "${BWHITE}\n\nRunning grep on .bashrc\n\n${NC}"
printf "${LCYAN}Grep Results:${NC} ${LGREEN}${catpath}\n\n${NC}"
printf "${YELLOW}Please edit: ${HOME}/.bashrc:${NC}\n\n"
printf "${YELLOW}Above are results for grep on .bashrc, if nothing is there then please add:\n\n${NC}${BWHITE}"
echo -e 'export PATH=$PATH:/usr/local/go/bin' && printf "\n\n${NC}"
else
printf "${LGREEN}\n\ngo has been added to your path in ${HOME}/.bashrc\n\n${NC}"
fi
fi
}
fetch_
extract-install_
add-path_
;;
--help | -h)
printf "${BWHITE}\nUseage ${0} [options] [arguments]\n\n${NC}"
printf "--set-version enter in an existing go version to download\n"
printf "--help, -help Display this help page"
;;
esac

View File

@@ -1,50 +0,0 @@
#!/bin/bash
URL="https://wire-app.wire.com/linux/wire_2.12.2729_amd64.deb"
# Colors
RED='\033[0;31m'
LRED="\033[1;31m"
BLUE="\033[0;34m"
LBLUE="\033[1;34m"
GREEN="\033[0;32m"
LGREEN="\033[1;32m"
YELLOW="\033[1;33m"
CYAN="\033[0;36m"
LCYAN="\033[1;36m"
PURPLE="\033[0;35m"
LPURPLE="\033[1;35m"
BWHITE="\e[1m"
NC='\033[0m' # No Color
checkDeps()
{
if [ ! -f /usr/bin/gdebi ];then
printf "${LBLUE}Downloading dependencies..${NC}\n"
sudo apt update
sudo apt-get -y install gdebi
if [ ! -f /usr/bin/gdebi ];then
printf "${LRED}gdebi could not be found, I installed it but it's not there${NC}\n"
printf "${LRED}I normally use gdebi to install individual packages${NC}\n"
exit 0;
fi
fi
}
getWire()
{
printf "${LBLUE}Downloading wire...${NC}\n"
wget ${URL}
printf "${LCYAN}Installing Wire...${NC}\n"
sudo gdebi -n wire_2.12.2729_amd64.deb
}
checkDeps
getWire

View File

@@ -1,7 +0,0 @@
#!/bin/bash
KEYFILE="/home/mollusk/.ssh/gitbutter_thinkpad"
ssh-add ${KEYFILE}
eval `ssh-agent`

View File

@@ -19,8 +19,10 @@ NC='\033[0m' # No Color
if [ ! -f /usr/bin/nmap ];then
printf "${LRED} Nmap is not installed...${NC}\n"
else
elif [ ! -z "${1}" ];then
nmap -sP "${1}/24"
else
printf "${LGREEN}Looking up ${lanip}...${NC}\n"
nmap -sP ${lanip}/24 # Use sudo to get names of devies
fi

View File

@@ -1,8 +0,0 @@
#!/bin/bash
pkglist="usbutils pcmanfm net-tools gmusicbrowser pianobar chromium
deluge chromium-pepper-flash gcc-c++ mlocate gvfs ntfs-3g
atom terminator alsa-utils xfce4-whiskermenu-plugin playonlinux"
tux i void-repo-nonfree void-repo-multilib
tux i ${pkglist}

View File

@@ -2,7 +2,7 @@
pkgname="master"
pkgurl="https://github.com/cilynx/rtl88x2BU_WiFi_linux_v5.3.1_27678.20180430_COEX20180427-5959/archive/${pkgname}.zip"
pkgurl="git@github.com:cilynx/rtl88x2bu/${pkgname}.zip"
installcmd="dnf install"
installcmdextra="dnf group install"
pkgdeps="wget unzip dnsmasq hostapd bc dkms kernel-headers rsync"

View File

@@ -1,12 +0,0 @@
#!/bin/bash
xbps-install -Su
if [ $? = 0 ];then
echo "Success!"
elif [ $? = 1 ];then
echo "Nothing to see here"
fi

6
svc.sh
View File

@@ -35,7 +35,7 @@ help(){
printf """
svc - Service Commander - frontend for the sv command
Usage: svc enable | unenable | enableed | list | up | start | restart | stop <service>
Usage: svc enable | disable | enabled | list | up | start | restart | stop <service>
For detailed help, see the commands below:
@@ -45,7 +45,7 @@ start Start an enabled service
restart Restart a enabled service
stop Stop an enabled service
enable Symenlink directory/file to /var/service
unenable Remove symlink from /var/service
disable Remove symlink from /var/service
enabled View synlinked paths of all services
ls List enabled and unenabled service files
up Show status of running services
@@ -59,7 +59,7 @@ case $1 in
ln -v -s /etc/sv/"${2}" /var/service/
;;
unenable | --remove-service )
disable | --remove-service )
rm -v /var/service/"${2}"
;;

View File

@@ -1,126 +0,0 @@
#!/bin/bash
# Name : telegram-installer.sh
############################################################################
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
############################################################################
URL="https://tdesktop.com/linux"
FILE="tsetup.tar.xz"
OUTDIR="${HOME}/.telegram/bin"
SYMDIR="/usr/bin"
#check and create directories
checkDir(){
if [ ! -d ${OUTDIR} ];then
mkdir -v -p ${OUTDIR}
if [ ! -d ${OUTDIR} ];then
echo "The directory '${OUTDIR}' could not be created"
return false
fi
else
return 0
fi
}
askOpen(){
echo -n "Do you want to run telegram now?[y/n]"
read runNow
if [ "${runNow}" = "y" ];then
${OUTDIR}/Telegram/Telegram
else
return 1
fi
}
createSym(){
echo -n "Do you want to create a symlink to ${SYMDIR}?[y/n](requires root): "
read symchoice
if [ ${symchoice} = "n" ];then
return 1
else
sudo ln -s -v ${OUTDIR}/Telegram/Telegram ${SYMDIR}/telegram
fi
}
chkInstall(){
if [ -d ~/.telegram ];then
echo
echo -n "Telegram is already installed, would you like to uninstall it?[y/n]: "
read choice
if [ "${choice}" = "y" ];then
echo
echo "Removing symlink from ${SYNDIR}..."
sudo rm /usr/bin/telegram
echo
echo "Removing ${OUTDIR}..."
echo
rm -r -v ~/.telegram
if [ ! -d ~/.telegram ];then
echo
echo "Telegram is uninstalled"
exit 0;
else
echo
echo "Telegram is still installed, please remove it manually"
fi
else
echo
echo "Skipping removal"
exit 0;
fi
else
echo
echo "Telegram is not installed"
fi
}
#Pull everything together
main(){
chkInstall
checkDir
if [ ! checkDir ];then
echo "Looks like something went wrong creating the directory"
else
if [ ! -f /tmp/${FILE} ];then
wget -O /tmp/${FILE} ${URL}
tar xvf /tmp/${FILE} -C ${OUTDIR}
echo
createSym
askOpen
elif [ -f /tmp/${FILE} ];then
tar xvf /tmp/${FILE} -C ${OUTDIR}
echo
createSym
askOpen
else
echo "Looks like the file does not exist"
echo "Check your internet connection and system permissions"
return false
fi
fi
}
main

60
uppy.sh
View File

@@ -1,60 +0,0 @@
#!/bin/bash
CONFIG="~/config/.uppy.conf"
# Colors
RED='\033[0;31m'
LRED="\033[1;31m"
BLUE="\033[0;34m"
LBLUE="\033[1;34m"
GREEN="\033[0;32m"
LGREEN="\033[1;32m"
YELLOW="\033[1;33m"
CYAN="\033[0;36m"
LCYAN="\033[1;36m"
PURPLE="\033[0;35m"
LPURPLE="\033[1;35m"
BWHITE="\e[1m"
NC='\033[0m' # No Color
if [ ! -f /usr/bin/apt ];then
echo -e "${LRED}Apt is missing!..exiting!${NC}\n"
exit 1
fi
if [ ! -f ${CONFIG} ];then
echo -e "${LBLUE}Creating config in ${CONFIG}${NC}\n"
touch ${CONFIG}
fi
if grep -Fxq "AUTOCONFIRM='true'" ${CONFIG};then
AUTO="yes"
else
echo -n "Do you want to skip confirmations?[n/Y]"
read confirm
if [ "${confirm}" = "y" ];then
echo "AUTOCONFIRM='true'" > ${CONFIG}
fi
fi
echo -e "${LBLUE}Checking Sources...${NC}\n"
sudo apt update
echo -e "${LBLUE}Starting Upgrade...${NC}\n"
if [ "${AUTO}" = "yes" ];then
sudo apt -y upgrade
else
sudo apt upgrade
fi

View File

@@ -1,164 +0,0 @@
#!/bin/bash
APP="wire-desktop"
NPM_DIR="/usr/bin/npm"
BIN_DIR="/home/${USER}/wire-packages"
PACKAGE_DEFAULT_DIR="$(pwd)/wrap/dist"
SUPER_USER_CMD="sudo"
REPO_URL="https://github.com/wireapp/${APP}.git"
# Colors
RED='\033[0;31m'
LRED="\033[1;31m"
BLUE="\033[0;34m"
LBLUE="\033[1;34m"
GREEN="\033[0;32m"
LGREEN="\033[1;32m"
YELLOW="\033[1;33m"
CYAN="\033[0;36m"
LCYAN="\033[1;36m"
PURPLE="\033[0;35m"
LPURPLE="\033[1;35m"
BWHITE="\e[1m"
NC='\033[0m' # No Color
if [[ $EUID -eq 0 ]]; then
printf "${LRED}Do not run this script as root${NC}\n" 1>&2
exit 1
fi
check_repo(){
if [ ! -d ${APP} ];then
git clone ${REPO_URL}
elif [ -d .git ];then
printf "\n${LRED}This is already a Git repository!${NC}\n"
fi
}
check_sudo(){
if [ ! -f /usr/bin/sudo ];then
SUPER_USER_CMD="su -c"
fi
}
apt_install(){
local PACKAGES="git make nodejs npm"
printf "${LCYAN}Fetching dependencies${NC}\n\n"
${SUPER_USER_CMD} apt install ${PACKAGES}
}
dnf_install(){
local PACKAGES='rpm-build rpmdevtools make nodejs npm nss libXScrnSaver git'
printf "${LCYAN}Fetching dependencies${NC}\n\n"
${SUPER_USER_CMD} dnf install ${PACKAGES}
}
zypper_install(){
local PACKAGES="make git nodejs npm"
printf "${LCYAN}Fetching dependencies${NC}\n\n"
${SUPER_USER_CMD} 'zypper install "${PACKAGES}"'
}
check_deps(){
declare -a FIND_PACKAGE_MANAGER=(
"apt"
"dnf"
"zypper")
for i in ${FIND_PACKAGE_MANAGER[@]};do
PACKAGE_MANAGER=$(which ${i} 2> /dev/null)
echo "$PACKAGE_MANAGER"
if [ -n "${PACKAGE_MANAGER}" ];then
break
fi
done
if [[ "${PACKAGE_MANAGER}" = "/usr/bin/apt" ]];then
apt_install
elif [ "${PACKAGE_MANAGER}" = "/usr/bin/dnf" ];then
dnf_install
elif [[ "${PACKAGE_MANAGER}" = "/usr/bin/xbps-install" ]];then
xbps_install
elif [[ "${PACKAGE_MANAGER}" = "/usr/bin/zypper" ]];then
zypper_install
fi
}
build_deb(){
local ARCH="x64"
local TARGET="deb"
local UPDATE_OPTS="'clean:linux' 'update-keys' 'release-prod'"
local BUILD_OPTS="--arch=${ARCH} --target=${TARGET} 'electronbuilder:linux_other'"
npm install
npm update
sudo npm install -g grunt
sudo grunt 'clean:linux' 'update-keys' 'release-prod' 'bundle'
sudo grunt --arch=${ARCH} --target=${TARGET} 'electronbuilder:linux_other'
sudo mv -v ${PACKAGE_DEFAULT_DIR}/*.${TARGET} ${BIN_DIR}
}
build_rpm(){
local ARCH="x64"
local TARGET="rpm"
local UPDATE_OPTS="'clean:linux' 'update-keys' 'release-prod'"
local BUILD_OPTS="--arch=${ARCH} --target=${TARGET} 'electronbuilder:linux_other'"
npm install
npm update
npm install grunt
grunt 'clean:linux' 'update-keys' 'release-prod'
grunt --arch=${ARCH} --target=${TARGET} 'electronbuilder:linux_other'
mv -v ${PACKAGE_DEFAULT_DIR}/*.${TARGET} ${BIN_DIR}
}
git_pull(){
if [ -d .git ];then
git stash
git pull origin master
fi
}
main(){
if [ ! -d ${BIN_DIR} ];then
mkdir -pv ${BIN_DIR}
fi
case $1 in
all | -a) check_deps && git_pull && build_rpm && build_deb
;;
deb | -d) git_pull && build_deb
;;
rpm | -r) check_deps && git_pull && build_rpm
;;
clone | -c) check_repo
;;
*)
printf "\n\n"
printf "Usage: $0 [-a/all | -d/deb | -r/rpm ]\n\n"
printf " -a | all build all package formats\n"
printf " -d | deb build only DEB package format\n"
printf " -r | rpm build only RPM package format\n"
printf " -c | clone clone 'wire-desktop' from Github\n\n"
;;
esac
}
main ${1}