Android – repo: no command found in auto bash script to build CyanogenMod
I am running Linux Mint 17.2. I have installed repo and added the path of repo to my. Bashrc. I have initiated my repurchase before
I have followed the instructions on the Android source downloading and how to build CyanogenMod pages
The problem is: I wrote a bash script to automate some commands I want to use to start the build. My script is in a simple form as follows:
#!/bin/bash
cd ~/Android/Cyanogenmod/cm12_1/android/system
source build/envsetup.sh
repo sync --force-sync -j8
exec $SHELL
When I run it, it reports:
/home/username/Desktop/Cyanogenmod_cm12_1_Grouper_Build : line 4 repo: command not found
If I copy and paste each line into a new terminal instance (or just run #! / bin / bash exec $shell script to open a terminal), it will run perfectly
What I have tried: I tried to add a sleep 10 before repo sync – force sync - J8, but it doesn't make any difference. Before trying repo sync - force sync - J8, I also tried to explicitly start repo and force it to be added to my path for direct use in the current terminal session. The test code is as follows:
#!/bin/bash
mkdir -p ~/Android/Cyanogenmod/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/Android/Cyanogenmod/bin/repo
chmod a+x ~/Android/Cyanogenmod/bin/repo
cd ~/Android/Cyanogenmod/cm12_1/android/system/
source build/envsetup.sh
PATH=~/Android/Cyanogenmod/bin/repo:$PATH
repo sync --force-sync -j8
exec $SHELL
The following two questions have similar titles, but neither do my questions, this and this
Any help or advice would be great, thank you!
resolvent:
In a word, the result is two problems. The first is that I try to manually set the path in the script. For example, path = ~ / Android / CyanogenMod / bin / repo: $path should only be path = ~ / Android / CyanogenMod / bin: $path
The second and bigger problem on the whole is the path variable (repo) incorrectly added in my. Bashrc. Fix this problem by adding the line export path = $path: $home / Android / CyanogenMod / bin at the end of my. Profile, and then log out