Hi repzeroworld,
Just don't give the full path to adstar folder. Take a look:
but if you do:Code:root@kali:~/root# ls adstar Desktop root@kali:~/root# tar -cvf adstar.tar adstar adstar/ adstar/adstar-HOW TOS.txt adstar/adstar.sh adstar/adstar
and if you extract adstar.tar then the extracted contents will placed at parent directory plus /root/adstar/.Code:root@kali:~# ls adstar Desktop root@kali:~# tar -cvf adstar.tar /root/adstar tar: Removing leading `/' from member names /root/adstar/ /root/adstar/adstar-HOW TOS.txt /root/adstar/adstar.sh /root/adstar/adstar
if you want better compression ration you can use bz2 algorithm:
also you can change this:Code:tar cjf adstart.tar.bz2 adstar
to this:Code:##Let's see...determine my working directory script_dir=`dirname "$0"`; if [ -e "$script_dir/adstar" ];then cd ~; cp -f "$script_dir/adstar" /etc/; fi if [ ! -e "$script_dir/adstar" ];then echo "Exiting...adstar program not found within this script's directory"; exit fi .... .....
basically it's almost the same thing but I like it most this wayCode:#!/bin/bash ##Let's see...determine my working directory script_dir=`pwd` if [ -e "$script_dir" ];then cp -f "$script_dir/adstar" /etc/adstar else echo "Exiting...adstar program not found within this script's directory" exit 1 fi ##adding directory path to .bashrc file path_check=`cat /root/.bashrc| grep -F 'export PATH=/etc:$PATH'` if [ -n "$path_check" ]; then echo -e "\e[32m\e[1mexisting adstar path found...." sleep 1 echo "continuing..." sleep 1 else echo "export PATH=/etc:"$PATH"" >> /root/.bashrc source /root/.bashrc fi echo "Successful!...." echo "To use adstar type 'adstar <command line>' in terminal!" ###
Last edited by Nick_the_Greek; 2014-10-18 at 11:10. Reason: new adstar.sh
Security always begins with personal responsibility. - quietman7
COMPRESSION WITH TAR (I SEE)
i see when using tar it is the path directories being created..THANKS(i think the tar help menu should be a little more detailed with this..haven't made time to expirement with tar compression feature)
CHANGING "dirname" to "pwd"
changing dirname $0 to pwd will only store WORKING directory into variable and this can cause problems with locating the actual adstar folder is..let us take a look at what happen
USING A MODIFIED SCRIPT BELOW WITH "PWD" WILL CAUSE SCRIPT NOT TO DETECT WORKING DIRECTORY OF SCRIPT
YOUR CODES
#!/bin/bash
##Let's see...determine my working directory
script_dir=`pwd`
echo "$script_dir";
RESULTS
root@kali:~# '/root/adstar/ad.sh'
/root #parent working directory and not the script working directory..remember this part of the code is to detect if adstar is in the SCRIPT'S WORKING DIRECTORY (in case someone move it)
MY CODES
#!/bin/bash
root@kali:~# '/root/adstar/ad.sh'
/root/adstar
##Let's see...determine my working directory
script_dir=`dirname $0`
echo "$script_dir";
RESULTS
root@kali:~# '/root/adstar/ad.sh'
/root/adstar #WORKING DIRECTORY OF SCRIPT WHICH SHOULD ALSO HAVE ADSTAR PROGRAM..SUCESSFUL DECTECTION
TO:NICK_THE_GREEK
whenever i am doing an updated version of adstar I WILL COMPRESS THIS WAY WITHOUT PATH DIRECTORY..CHEERS
Man, I understand what are saying but you must test again you sh script. Since you are suggesting in your adstar-HOW TOS.txt to:
that require to be into the adstar directory.1. Execute adstar.sh bash script in a terminal. This script will install
adstar to your terminal .bashrc file so that you can use the adstar
program from the terminal.
command:
#bash adstar.sh
Let's see again:
adstar was not copied to /etc/ and in .bash file was added the line that you want BUT $PATH was added as a word not as an variable, which look like this:Code:root@kali:~# cd adstar root@kali:~/adstar# ls adstar adstar-HOW TOS.txt adstar.sh root@kali:~/adstar# bash adstar.sh cp: omitting directory `./adstar' existing adstar path found.... continuing... Successful!.... To use adstar type 'adstar <command line>' in terminal! root@kali:~/adstar# adstar bash: adstar: command not found
See? Are you running your sh script in a different OS than Kali?Code:# enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi -e export PATH=/etc:$PATH
The same results are coming when I extract you .tar file to a different location let's say /root/Desktop/
Anyway. Run it your self in Kali and you will found your way.Code:root@kali:~/Desktop# cd adstar root@kali:~/Desktop/adstar# ls adstar adstar-HOW TOS.txt adstar.sh root@kali:~/Desktop/adstar# bash adstar.sh cp: cannot stat `./adstar': No such file or directory Exiting...adstar program not found within this script's directory
Glad I helped with tar.
Keep up you good work repzeroworld!
Security always begins with personal responsibility. - quietman7