Compare commits

..

4 Commits

Author SHA1 Message Date
995d5772ff genswap.sh: remove reboot code 2020-02-21 14:23:23 -07:00
97c1dfa3d3 remove: get-lbry.sh 2020-02-18 09:01:16 -07:00
9b81f94eae svc .sh: change interpreter to sh, update year 2020-02-18 04:19:23 -07:00
3fd6313c1e svc.sh: fix typos and code formatting 2020-02-17 21:41:18 -07:00
19 changed files with 656 additions and 227 deletions

46
.todo2
View File

@@ -1,46 +0,0 @@
{
"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~
View File

@@ -1,45 +0,0 @@
{
"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} until a connection is reached"
echo "Pinging: ${site}"
${pingcmd} ${site} &>/dev/null
if [ $? = "2" ];then
echo

View File

@@ -1,37 +0,0 @@
#!/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

View File

@@ -1,45 +0,0 @@
#!/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

19
func_test.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/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 ${SWAPPATH}/${SWAPNAME}...\n${NC}"
dd if=/dev/zero of=${SWAPPATH}${SWAPNAME} count=${TOTALRAM} bs=1MiB
echo -e "${LCYAN}\nCreating file in ${SWAPPATH}...\n${NC}"
fallocate -l ${TOTALRAM}M ${SWAPPATH}${SWAPNAME}
ls -lh ${SWAPPATH}${SWAPNAME}
sleep 1
@@ -85,20 +85,10 @@ function autoSwap(){
echo -e "${LRED}Swap line does not exist in /etc/fstab, please manually check this.${NC}\n"
else
echo -e "${LGREEN}Swap successfully added to /etc/fstab! Reboot to verify success...${NC}\n"
echo -e "${LGREEN}Swap successfully added to /etc/fstab${NC}\n"
echo -e "${YELLOW}Do you want to reboot your system now?(n/Y): ${NC}"
read rebootCheck
if [ "${rebootCheck}" = "y" ] || [ "${rebootCheck}" = "Y" ];then
echo -e "${LRED}Rebooting system in 3 seconds...${NC}\n"
sleep 3
sudo reboot
else
echo -e "\n${LGREEN}Swapfile setup complete, setting swappiness level...${NC}\n"
fi
echo -e "\n${LGREEN}Swapfile setup complete${NC}\n"
fi
}

56
gitbucket.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/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 Executable file
View File

@@ -0,0 +1,112 @@
#!/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

50
install-wire.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/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

7
loadsshkeys.sh Executable file
View File

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

View File

@@ -19,10 +19,8 @@ NC='\033[0m' # No Color
if [ ! -f /usr/bin/nmap ];then
printf "${LRED} Nmap is not installed...${NC}\n"
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

8
packages.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/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="git@github.com:cilynx/rtl88x2bu/${pkgname}.zip"
pkgurl="https://github.com/cilynx/rtl88x2BU_WiFi_linux_v5.3.1_27678.20180430_COEX20180427-5959/archive/${pkgname}.zip"
installcmd="dnf install"
installcmdextra="dnf group install"
pkgdeps="wget unzip dnsmasq hostapd bc dkms kernel-headers rsync"

12
status-test.sh Executable file
View File

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

68
svc.sh
View File

@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh
# SVC - SV Commander - frontend for the sv command
###############################################################################################
## Copyright (c) 2015, Justin Moore
## Copyright (c) 2015 - 2020, Justin Moore
##
## Permission to use, copy, modify, and/or distribute this software
## for any purpose with or without fee is hereby granted,
@@ -47,8 +47,8 @@ stop Stop an enabled service
enable Symenlink directory/file to /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
ls List enabled and disabled service files
up Show status of running services
"""
}
@@ -57,45 +57,45 @@ case $1 in
enable | --enable-service )
ln -v -s /etc/sv/"${2}" /var/service/
;;
;;
disable | --remove-service )
rm -v /var/service/"${2}"
;;
;;
enabled | --enabled-services )
cd /etc/sv && find -xtype l -exec ls -l {} \;
;;
enabled | --enabled-services )
cd /etc/sv && find -xtype l -exec ls -l {} \;
;;
list | ls | --list )
list | ls | --list )
echo
echo -e "${LGREEN}Available Services (/etc/sv/):${NC}\n"
ls /etc/sv
echo
echo -e "${LCYAN}Enabled Services (/var/service):${NC}\n"
echo
ls /var/service
echo
;;
echo
echo "${LGREEN}Available Services (/etc/sv/):${NC}\n"
ls /etc/sv
echo
echo "${LCYAN}Enabled Services (/var/service):${NC}\n"
echo
ls /var/service
echo
;;
up )
sv s /var/service/*
;;
up )
sv s /var/service/*
;;
start )
sv start "${2}"
;;
start )
sv start "${2}"
;;
restart )
sv restart "${2}"
;;
restart )
sv restart "${2}"
;;
stop )
sv stop "${2}"
;;
stop )
sv stop "${2}"
;;
--help | -h | help )
help
;;
*)
help
;;
esac

126
telegram-installer.sh Executable file
View File

@@ -0,0 +1,126 @@
#!/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 Normal file
View File

@@ -0,0 +1,60 @@
#!/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

164
wire-build.sh Executable file
View File

@@ -0,0 +1,164 @@
#!/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}