#!/bin/bash email=$1 patch=/tmp/$$.patch tempfile=/tmp/item_menu.$$ sources=~/pristine/ clear_repo(){ dialog --clear --yesno \ " Wanna reset the git tree?" 0 0 if [ $? -eq 0 ]; then git reset --hard fi } diff_patch(){ dialog --clear --yesno --yes-label "git diff" --no-label "difftool" \ "Choose DIFF format:" 0 0 if [ $? -eq 0 ]; then git diff else git difftool fi } apply_patch(){ repolist=$(ls $sources | awk '{print $1,$1}') dialog --clear --menu "Select repository to apply the patch" 0 0 20 $repolist 2> $tempfile #"Select repository to apply the patch" 30 60 20 $repolist 2> $tempfile repo=`cat $tempfile` echo $repo cd $sources/$repo git apply $patch #diff_patch clear_repo } clear_env(){ rm -rf $tempfile rm -rf $patch } ###main cat $email | formail -I "" > $patch #cat $email | formail -I "" | awk '/^---/{p=1}p' > /tmp/patch.patch apply_patch clear_env