Thread: Having trouble but don't know what...
hello all, i'll try , keep quick , short.
i've written script install , configure logkeys piece of code won't work reason. it's case function can't figure out. here code.
when run this script works bootfunct function... can me this, can't see i'm doing wrong. have highlighted in red think might wrong can't pin on anything.code:#!/bin/bash # # script installs , configures logkeys on static-static-desktop # check if root if [ "$(/usr/bin/id -u)" != "0" ]; exec /usr/bin/sudo "$0" else echo "elevated priviledges..." fi #define function logfunct logfunct() { echo "satisfying dependencies..." apt-get install build-essential [[ $? -eq 0 ]] || { echo "failed install build-essential, exiting..."; exit 1; } echo "downloading logkeys source... please wait: " mkdir $home/keylogger; cd $home/keylogger wget http://logkeys.googlecode.com/svn/wiki/keymaps/en_gb.map echo "downloaded en_gb.map " wget http://logkeys.googlecode.com/files/logkeys-0.1.1a.tar.gz [[ $? -eq 0 ]] || { echo "failed download logkeys source, exiting..."; exit 1; } echo "decompressing archive..." tar -xf logkeys-0.1.1a.tar.gz cd logkeys-0.1.1a echo "building package..." ./configure make make install [[ $? -eq 0 ]] || { echo "failed install logkeys, exiting..."; exit 1; } } if [ -f /usr/local/bin/logkeys ]; echo "logkeys installed..." else logfunct fi # define function bootfunct bootfunct() { cd ~ echo "creating backup of /etc/init.d/rc.local file..." [[ -e /etc/init.d/rc.local ]] && cp /etc/init.d/rc{.local,.bak} echo "adding code /etc/init.d/rc.local file..." cat <<'eof' >> /etc/init.d/rc.local /usr/local/bin/logkeys -s -m $home/keylogger/en_gb.map -o $home/keylogger/.loggy.log eof } clear echo "1=yes" echo "2=no" echo -n "would start keylogging session on boot: " read choice1 case $choice1 in 1) bootfunct ;; 2) echo "2 selected, exiting now..." exit ;; *) echo "invalid option selected bootfunct failed, exiting..." esac clear echo "1=yes" echo "2=no" echo -n "would start keylogging session now: " read choice case $choice in 1) sudo logkeys -s -m $home/keylogger/en_gb.map -o $home/keylogger/.loggy.log echo "logging session started, view log in keylogger directory..." ;; 2) echo "2 selected, exiting now..." ;; *) echo "invalid option selected, exiting now..." esac exit
people,
slashwannabe94
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] Having trouble but don't know what...
Ubuntu
Comments
Post a Comment