Last active
March 28, 2017 14:42
-
-
Save Tofull/d74960da4f11b96293bf8286d0168b12 to your computer and use it in GitHub Desktop.
Script to install atom with the same configuration. List of the packages I used with atom. Restore the packages with : apm install --packages-file packages.list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
BLUE='\033[0;34m' | |
NC='\033[0m' # No Color | |
function usage() | |
{ | |
echo "Atom installer with my package set. Requires sudo privileges. Without the option --no-install, install the atom editor" | |
echo "" | |
echo "./atom-installer.sh" | |
echo -e "\t-h --help" | |
echo -e "\t-p --with-proxy='<ENVIRONMENT>'" | |
echo -e "\t\t Example :" | |
echo -e "\t\t $ sudo ./atom-installer.sh --with-proxy='http://10.0.4.2:3128'" | |
echo -e "\t --no-install \t Only install my package set" | |
echo "" | |
} | |
INSTALL=true | |
while [ "$1" != "" ]; do | |
PARAM=`echo $1 | awk -F= '{print $1}'` | |
VALUE=`echo $1 | awk -F= '{print $2}'` | |
case $PARAM in | |
-h | --help) | |
usage | |
exit | |
;; | |
--no-install) | |
INSTALL=false | |
;; | |
-p | --with-proxy) | |
PROXY=$VALUE | |
;; | |
*) | |
echo "ERROR: unknown parameter \"$PARAM\"" | |
usage | |
exit 1 | |
;; | |
esac | |
shift | |
done | |
function setProxy() | |
{ | |
PROXY=$1 | |
apm config set https-proxy $PROXY | |
apm config set http-proxy $PROXY | |
apm config set strict-ssl false | |
} | |
if [[ "$INSTALL" = true ]]; then | |
# Installation d'atom | |
echo -e "${BLUE}Downloading atom release${NC}" | |
LatestUrlRedirection="$(curl https://github.com/atom/atom/releases/latest)" | |
echo "" | |
echo "" | |
echo $LatestUrlRedirection | |
LatestVersionUrl="$(grep -o -E 'href="([^"#]+)"' <<< $LatestUrlRedirection)" | |
PrefixUrlForDownload="$(cut -d'"' -f2 <<< $LatestVersionUrl)" | |
PrefixUrlForDownload="$(awk '{gsub(/tag/,"download")}1' <<< $PrefixUrlForDownload)" | |
SufixUrlForDownload="/atom-amd64.deb" | |
UrlForDownload="$PrefixUrlForDownload$SufixUrlForDownload" | |
echo "" | |
echo "" | |
echo $UrlForDownload | |
echo -e "${BLUE}Getting the .deb file${NC}" | |
wget --progress=bar $UrlForDownload -O /tmp/atom-amd64.deb || { echo -e "${RED}Connection issue, please check help. Maybe the proxy option is missing.${NC}";exit 1;} | |
echo -e "${BLUE}Setting atom-amd64.deb${NC}" | |
sudo dpkg -i /tmp/atom-amd64.deb | |
echo -e "${BLUE}Cleaning atom installer files${NC}" | |
rm /tmp/atom-amd64.deb | |
echo -e "${GREEN}Atom is now successfully installed${NC}" | |
else | |
echo -e "${GREEN}Atom is already installed${NC}" | |
fi | |
# Configuration du proxy | |
if [ "$PROXY" != "" ] | |
then | |
setProxy $PROXY | |
fi | |
# Installation des packages | |
echo -e "${BLUE}Getting packages list${NC}" | |
curl -o packages.list https://gist.githubusercontent.com/Tofull/d74960da4f11b96293bf8286d0168b12/raw/packages.list | |
apm install --packages-file packages.list | |
echo -e "${BLUE}Cleaning atom packages files${NC}" | |
rm packages.list | |
rm -r /tmp/npm-* | |
echo -e "${GREEN}Atom is now successfully installed with all the amazing packages${NC}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
atom-beautify | |
atom-clock | |
atom-html-preview | |
autocomplete-modules | |
color-picker | |
emmet | |
git-plus | |
highlight-selected | |
minimap | |
pdf-view | |
pigments | |
platformio-ide-terminal | |
simple-drag-drop-text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment