Last active
October 9, 2015 05:48
-
-
Save zundr/3448412 to your computer and use it in GitHub Desktop.
Revisions
-
zundr revised this gist
Jun 10, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -82,7 +82,7 @@ function ensure_package() { msg $GREEN "Package $1 installed, OK" return fi if dpkg -s $package | grep "install ok installed" >/dev/null 2>&1; then return; fi msg $BOLD "Installing $package..." if test -z "$NO_SUDO"; then -
zundr revised this gist
Jun 10, 2013 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -89,7 +89,6 @@ function ensure_package() { msg $GREEN "If you cannot SUDO just press Ctrl-C" if sudo apt-get install $package; then NO_SUDO=1 fi fi -
zundr revised this gist
Jun 10, 2013 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -100,12 +100,14 @@ function ensure_package() { local target_dir=$PWD/tmp/$package mkdir -p $target_dir dpkg-deb --extract $target_deb $target_dir export CFLAGS="-I$target_dir/usr/include $CFLAGS" export CPPFLAGS="-I$target_dir/usr/include $CFLAGS" export LDFLAGS="-L$target_dir/usr/lib $LDFLAGS" export RUBYLIB="$target_dir/usr/lib:$RUBYLIB" export PKG_CONFIG_PATH="$target_dir/usr/lib/pkgconfig:$PKG_CONFIG_PATH" export PATH="$target_dir/usr/bin:$PATH" hash -r } function link_binaries() { -
zundr revised this gist
Jun 10, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -100,11 +100,12 @@ function ensure_package() { local target_dir=$PWD/tmp/$package mkdir -p $target_dir dpkg-deb --extract $target_deb $target_dir export PATH="$target_dir/usr/bin:$PATH" export CFLAGS="-I$target_dir/usr/include $CFLAGS" export CPPFLAGS="-I$target_dir/usr/include $CFLAGS" export LDFLAGS="-L$target_dir/usr/lib $LDFLAGS" export RUBYLIB="$target_dir/usr/lib:$RUBYLIB" export PKG_CONFIG_PATH="$target_dir/usr/lib/pkgconfig:$PKG_CONFIG_PATH" } function link_binaries() { -
zundr revised this gist
Jun 10, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ function msg() { local color="\033[${1}m" local message=$2 local normal="\033[0m" echo -e "${color}${message}${normal}" } function link_files() { -
zundr revised this gist
Jun 10, 2013 . 1 changed file with 20 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,10 @@ function msg() { local color="\033[${1}m" local message=$2 local normal="\033[0m" echo -e "${color}${message}${normal} } function link_files() { local source_dir=$1 local pattern=$2 @@ -64,21 +71,26 @@ function link_directory() { fi } BOLD="1;31" GREEN="32" function ensure_package() { local package=$1 local testfile=$2 msg $GREEN "Checking for $package ($testfile)..." if test -n "$testfile" -a -f "$testfile"; then msg $GREEN "Package $1 installed, OK" return fi if dpkg -s $package >/dev/null 2>&1; then return; fi msg $BOLD "Installing $package..." if test -z "$NO_SUDO"; then msg $GREEN "If you cannot SUDO just press Ctrl-C" if sudo apt-get install $package; then NO_SUDO=1 return fi fi # try local install (fails if several versions available :/) -
zundr revised this gist
Jun 10, 2013 . 1 changed file with 8 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -64,15 +64,20 @@ function link_directory() { fi } NORMAL="\033[0m" BOLD="\033[1;31m" GREEN="\033[32m" function ensure_package() { local package=$1 local testfile=$2 echo "${BOLD}Checking for $package ($testfile)...${NORMAL}" if test -n "$testfile" -a -f "$testfile"; then echo "${GREEN}Package $1 installed, OK${NORMAL}"; return; fi if dpkg -s $package >/dev/null 2>&1; then return; fi echo -n "Installing $package..." if test -z "$NO_SUDO"; then echo -e "${GREEN}If you cannot SUDO just press Ctrl-C${NORMAL}" if sudo apt-get install $package; then NO_SUDO=1; return; fi fi @@ -87,6 +92,7 @@ function ensure_package() { export CPPFLAGS="-I$target_dir/usr/include $CFLAGS" export LDFLAGS="-L$target_dir/usr/lib $LDFLAGS" export RUBYLIB="$target_dir/usr/lib:$RUBYLIB" export PKG_CONFIG } function link_binaries() { -
zundr revised this gist
Jun 10, 2013 . 1 changed file with 12 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -94,4 +94,16 @@ function link_binaries() { local bin_dir=$HOME/bin mkdir -p $bin_dir cp -sfv --target-directory=$bin_dir $source_dir/bin/* } function git_clone_or_update() { local repo_url=$1 local target_dir=$2 if [ -d $target_dir ]; then echo "Updating repo..." (cd $target_dir && git pull) else echo "Cloning repo $repo_url..." git clone $repo_url $target_dir fi } -
zundr revised this gist
Jun 10, 2013 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -66,10 +66,15 @@ function link_directory() { function ensure_package() { local package=$1 local testfile=$2 if test -n "$testfile" -a -f "$testfile"; then echo "Package $1 installed, OK"; return; fi if dpkg -s $package >/dev/null 2>&1; then return; fi echo -n "Installing $package..." if test -z "$NO_SUDO"; then echo -e "\033[32mIf you cannot SUDO just press Ctrl-C\033[0m" if sudo apt-get install $package; then NO_SUDO=1; return; fi fi # try local install (fails if several versions available :/) local filename=$(apt-cache show $package|perl -ne 'print $1 if m/Filename: (.*)/') -
zundr revised this gist
May 30, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -69,7 +69,7 @@ function ensure_package() { if dpkg -s $package >/dev/null 2>&1; then return; fi echo -n "Installing $package..." # if sudo apt-get install $package; then return; fi # try local install (fails if several versions available :/) local filename=$(apt-cache show $package|perl -ne 'print $1 if m/Filename: (.*)/') @@ -78,6 +78,7 @@ function ensure_package() { local target_dir=$PWD/tmp/$package mkdir -p $target_dir dpkg-deb --extract $target_deb $target_dir export CFLAGS="-I$target_dir/usr/include $CFLAGS" export CPPFLAGS="-I$target_dir/usr/include $CFLAGS" export LDFLAGS="-L$target_dir/usr/lib $LDFLAGS" export RUBYLIB="$target_dir/usr/lib:$RUBYLIB" -
zundr revised this gist
Nov 7, 2012 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -69,6 +69,9 @@ function ensure_package() { if dpkg -s $package >/dev/null 2>&1; then return; fi echo -n "Installing $package..." if sudo apt-get install $package; then return; fi # try local install (fails if several versions available :/) local filename=$(apt-cache show $package|perl -ne 'print $1 if m/Filename: (.*)/') local target_deb=$PWD/tmp/$package.deb wget -c http://ftp.de.debian.org/debian/$filename -O $target_deb -
zundr revised this gist
Oct 4, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,8 @@ function link_file() { local old_link="$(readlink $target_file)" if [ "$old_link" = "$source_file" ]; then echo "$file_name: already linked" else rm --force $target_file cp --force --symbolic-link $source_file $target_dir echo "$file_name: replaced (was linking to $old_link)" fi -
zundr revised this gist
Oct 3, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -76,6 +76,7 @@ function ensure_package() { dpkg-deb --extract $target_deb $target_dir export CPPFLAGS="-I$target_dir/usr/include $CFLAGS" export LDFLAGS="-L$target_dir/usr/lib $LDFLAGS" export RUBYLIB="$target_dir/usr/lib:$RUBYLIB" } function link_binaries() { -
zundr revised this gist
Sep 14, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -74,7 +74,7 @@ function ensure_package() { local target_dir=$PWD/tmp/$package mkdir -p $target_dir dpkg-deb --extract $target_deb $target_dir export CPPFLAGS="-I$target_dir/usr/include $CFLAGS" export LDFLAGS="-L$target_dir/usr/lib $LDFLAGS" } -
zundr revised this gist
Sep 14, 2012 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -77,3 +77,10 @@ function ensure_package() { export CFLAGS="-I$target_dir/usr/include $CFLAGS" export LDFLAGS="-L$target_dir/usr/lib $LDFLAGS" } function link_binaries() { local source_dir=$1 local bin_dir=$HOME/bin mkdir -p $bin_dir cp -sfv --target-directory=$bin_dir $source_dir/bin/* } -
zundr revised this gist
Sep 14, 2012 . 1 changed file with 16 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -61,4 +61,19 @@ function link_directory() { ln --symbolic --target-directory=$target_dir $source_file echo "$file_name: replaced (backed up old file)" fi } function ensure_package() { local package=$1 if dpkg -s $package >/dev/null 2>&1; then return; fi echo -n "Installing $package..." local filename=$(apt-cache show $package|perl -ne 'print $1 if m/Filename: (.*)/') local target_deb=$PWD/tmp/$package.deb wget -c http://ftp.de.debian.org/debian/$filename -O $target_deb local target_dir=$PWD/tmp/$package mkdir -p $target_dir dpkg-deb --extract $target_deb $target_dir export CFLAGS="-I$target_dir/usr/include $CFLAGS" export LDFLAGS="-L$target_dir/usr/lib $LDFLAGS" } -
zundr revised this gist
Aug 24, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ function link_files() { local source_dir=$1 local pattern=$2 local target_dir=$3 -
zundr revised this gist
Aug 24, 2012 . 1 changed file with 34 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,17 @@ unction link_files() { local source_dir=$1 local pattern=$2 local target_dir=$3 echo "** Processing $source_dir" local files="$(find $source_dir -mindepth 1 -maxdepth 1 -name "$pattern")" if [ -n "$files" ]; then mkdir -p $target_dir for file in $files; do if [ -d $file ]; then link_directory $file $target_dir else link_file $file $target_dir fi done else echo "No files to link!" @@ -19,19 +23,42 @@ function link_file() { local target_dir=$2 local file_name="$(basename $source_file)" local target_file="$target_dir/$file_name" if [ ! -e $target_file ]; then cp --symbolic-link $source_file $target_dir echo "$file_name: linked!" elif [ -L $target_file ]; then local old_link="$(readlink $target_file)" if [ "$old_link" = "$source_file" ]; then echo "$file_name: already linked" else cp --force --symbolic-link $source_file $target_dir echo "$file_name: replaced (was linking to $old_link)" fi else VERSION_CONTROL=numbered cp --backup --symbolic-link $source_file $target_dir echo "$file_name: replaced (backed up old file)" fi } function link_directory() { local source_file=$1 local target_dir=$2 local file_name="$(basename $source_file)" local target_file="$target_dir/$file_name" if [ ! -e $target_file ]; then ln --symbolic --target-directory=$target_dir $source_file echo "$file_name: linked!" elif [ -L $target_file ]; then local old_link="$(readlink $target_file)" if [ "$old_link" = "$source_file" ]; then echo "$file_name: already linked" else ln --symbolic --target-directory=$target_dir --force $source_file echo "$file_name: replaced (was linking to $old_link)" fi else VERSION_CONTROL=numbered mv $target_file $target_file-old ln --symbolic --target-directory=$target_dir $source_file echo "$file_name: replaced (backed up old file)" fi } -
zundr revised this gist
Aug 24, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ function link_files() { local pattern=$2 local target_dir=$3 echo "** Processing $source_dir" local files="$(find $source_dir -maxdepth 1 -type f -name "$pattern")" if [ -n "$files" ]; then mkdir -p $target_dir for file in $files; do -
zundr renamed this gist
Aug 24, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
zundr created this gist
Aug 24, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ function link_files() { local source_dir=$1 local pattern=$2 local target_dir=$3 echo "** Processing $source_dir" local files="$(find $source_dir -type f -name "$pattern")" if [ -n "$files" ]; then mkdir -p $target_dir for file in $files; do link_file $file $target_dir done else echo "No files to link!" fi } function link_file() { local source_file=$1 local target_dir=$2 local file_name="$(basename $source_file)" local target_file="$target_dir/$file_name" if [ ! -f $target_file ]; then echo "$file_name: linked!" cp --symbolic-link $source_file $target_dir elif [ -L $target_file ]; then local old_link="$(readlink $target_file)" if [ "$old_link" = "$source_file" ]; then echo "$file_name: already linked" else echo "$file_name: replaced (was linking to $old_link)" cp --force --symbolic-link $source_file $target_dir fi else echo "$file_name: replaced (backed up old file)" VERSION_CONTROL=numbered cp --backup --symbolic-link $source_file $target_dir fi }