Scripts for nightly builds

Discussion in 'Cyanogenmod' started by jeffv2, Feb 20, 2011.

  1. jeffv2
    Offline

    jeffv2 Developer Developer

    Joined:
    Dec 23, 2010
    Messages:
    1,240
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    south jersey
    Ratings:
    +0
    here's my script for nightly builds.
    i can add anything you want. just ask

    FEATURES:

    - checks if script has been run before. ( on current build )
    - removes unneeded apps
    - changes wifi scantime
    - remaps keys ( only if you have a file on sdcard called jeffv2 "/sdcard/jeffv2" )
    - has option to change lcd density ( you must manually change the value in the script for now )
    - reboots the phone if you have /sdcard/reboot file


    put on the root of sdcard & run

    HTML:
    su
    
    . /sdcard/setup.txt
    
    HTML:
    #!/bin/bash
    #
    
    #######edit these values
    lcd=240
    wifi=90
    heap=24m
    #######
    
    file=/system/.setup
    remap=/sdcard/jeffv2
    reboot=/sdcard/reboot
    
    
    if [ -f "$file" ]; then 
    echo "no need to run twice !!!" 
    else
    sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=240/g' /system/build.prop
    sed -i 's/wifi.supplicant_scan_interval = 15/wifi.supplicant_scan_interval = $wifi/g' /system/build.prop
    sed -i 's/ro.telephony.call_ring.delay=3000/ro.telephony.call_ring.delay=1000/g' /system/build.prop
    sed -i 's/ro.media.dec.jpeg.memcap=20000000/ro.media.dec.jpeg.memcap=24000000/g' /system/build.prop
    sed -i 's/dalvik.vm.heapsize=24m/dalvik.vm.heapsize=$heap/g' /system/build.prop
    
    rm /system/app/Calendar.apk
    rm /system/app/CalendarProvider.apk
    rm /system/app/CarHomeLauncher.apk
    rm /system/app/GoogleCalendarSyncAdapter.apk
    rm /system/app/GoogleQuickSearchBox.apk
    rm /system/app/LatinImeTutorial.apk
    rm /system/app/LiveWallpapers.apk
    rm /system/app/LiveWallpapersPicker.apk
    rm /system/app/MagicSmokeWallpapers.apk
    rm /system/app/PicoTts.apk
    rm /system/app/Protips.apk
    rm /system/app/SetupWizard.apk
    rm /system/app/SoundRecorder.apk
    rm /system/app/TtsService.apk
    rm /system/app/VisualizationWallpapers.apk
    rm /system/app/VoiceDialer.apk
    rm /system/app/VpnServices.apk
    rm /system/app/FileManager.apk
    rm /system/app/ADWLauncher.apk
    echo  > $file
    
    if [ -f "$remap" ]; then
    sed -i 's/key 114   VOLUME_DOWN       WAKE/key 114   VOLUME_UP         WAKE/g' /system/usr/keylayout/qwerty.kl
    sed -i 's/key 114   VOLUME_DOWN       WAKE/key 114   VOLUME_UP         WAKE/g' /system/usr/keylayout/sholes-keypad.kl 
    sed -i 's/key 212   CAMERA/key 212   VOLUME_DOWN       WAKE/g' /system/usr/keylayout/qwerty.kl
    sed -i 's/key 212   CAMERA/key 212   VOLUME_DOWN       WAKE/g' /system/usr/keylayout/sholes-keypad.kl
    else 
    
    echo  > $file
    
    if [ -f "$reboot" ]
    then
    reboot
    else
    echo "thanks for using my script"
    fi
    fi
    fi
    
    Last edited: Mar 8, 2011
  2. Bear in NM
    Offline

    Bear in NM Active Member

    Joined:
    Nov 12, 2009
    Messages:
    1,389
    Likes Received:
    1
    Trophy Points:
    38
    Ratings:
    +1
    You Linux guys, no fair:) Fox and I were discussing this earlier in the main nightly thread. He/she prefers the longer scripting like yours. I tend to break mine up, using Gscript. The definate advantage to your method is being able to use the native terminal program if you choose. Me, I gotta hit the market to get Gscript. Does help showcase why a basic terminal and file manager is stock. Options, options. And thankfully our ADB days are mostly behind us, unless you are really hard core.

    Thanks for posting your script. It actually give me a point of reference to research. WAG, sed, search and edit?????? For us windows types, the webpages with linux 101 commands and codes tend to be sorely lacking.

    Craig
  3. gambit07
    Offline

    gambit07 Member

    Joined:
    Oct 22, 2010
    Messages:
    384
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    Looks good! I'm guessing I can just save this in a text file but what does the extension have to be?
    Edit: Also just curious, why do you remap your volume keys?
    Last edited: Feb 20, 2011
  4. CJM
    Offline

    CJM Developer Relations Staff Member Rescue Squad Premium Member

    Joined:
    Sep 12, 2010
    Messages:
    9,445
    Likes Received:
    588
    Trophy Points:
    228
    Location:
    Mississippi Gulf Coast
    Ratings:
    +590
    Thanks for posting this, Jeff.

    Swyped from a Droid
  5. winner00
    Offline

    winner00 Premium Member Premium Member Developer

    Joined:
    Nov 15, 2009
    Messages:
    1,112
    Likes Received:
    10
    Trophy Points:
    38
    Location:
    Utah
    Ratings:
    +10
    I think his up or down volume key is broken.
  6. gambit07
    Offline

    gambit07 Member

    Joined:
    Oct 22, 2010
    Messages:
    384
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    Alright, I figure it's just .sh, my other question is where is data/local/bin? I opened up root explorer to try and find it but the only folders in data/local are download and tmp.
  7. gambit07
    Offline

    gambit07 Member

    Joined:
    Oct 22, 2010
    Messages:
    384
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    I've also tried putting setup.sh in the local folder and CD'ing up to it to run from there but I just get setup.sh not found. Any ideas?
  8. 666ogre666
    Offline

    666ogre666 Member

    Joined:
    Feb 25, 2010
    Messages:
    583
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    New Jersey
    Ratings:
    +1
    This script looks cool, im assuming I could remove sections and have it still run? Some of the features your remove I use and I have no need to remap and buttons.
  9. jeffv2
    Offline

    jeffv2 Developer Developer

    Joined:
    Dec 23, 2010
    Messages:
    1,240
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    south jersey
    Ratings:
    +0
    /data/local/bin is a path that terminal emulator already has as a path, so you can drop any scripts or anything like that there.. but you have to make the folder. & I remap my keys because my volume up button is broken. So I make my camera button the volume down :)

    Sent from my Droid using Tapatalk
  10. jeffv2
    Offline

    jeffv2 Developer Developer

    Joined:
    Dec 23, 2010
    Messages:
    1,240
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    south jersey
    Ratings:
    +0
    And yes, edit and use this to your likeing. When you run iit just type ". Setup.sh" with that extra period.

    I also added a

    If [ -f "/sdcard/reboot" ]
    Then
    Reboot
    Fi

    To the script, this. Way if the user has a blank file on the sdcard that's named reboot then the phone will reboot after running the command

    Sent from my Droid using Tapatalk
  11. iamasongnow
    Offline

    iamasongnow Member

    Joined:
    Sep 13, 2010
    Messages:
    190
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Albany, NY
    Ratings:
    +0
    hmm... i put the file right in /data/local/bin but terminal is saying it's not found. do i have to edit permissions? what do i type in terminal? i tried "setup.sh" and ". Setup.sh" but to no avail.
  12. gambit07
    Offline

    gambit07 Member

    Joined:
    Oct 22, 2010
    Messages:
    384
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    I edited permissions and finally got it to recognize the script by using . Setup.sh, however when I run it I get a bunch of errors about files not found (some of which should be there to remove) and the wifi supplicant scan and density were not changed (doesn't look like they ran at all). This is how my file looks

  13. jeffv2
    Offline

    jeffv2 Developer Developer

    Joined:
    Dec 23, 2010
    Messages:
    1,240
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    south jersey
    Ratings:
    +0

    You have to run su first

    Sent from my Droid using Tapatalk
  14. jeffv2
    Offline

    jeffv2 Developer Developer

    Joined:
    Dec 23, 2010
    Messages:
    1,240
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    south jersey
    Ratings:
    +0
    I'm going to firgure out what the permissions have to be.

    Sent from my Droid using Tapatalk
  15. gambit07
    Offline

    gambit07 Member

    Joined:
    Oct 22, 2010
    Messages:
    384
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    I did, I also gave it full permissions, still not working for me
Search tags for this page
android daily build script
,
create and run a script nightly
,
daily build script
,

nightly build script

,
ro.media.dec.jpeg.memcap