User:Ixo/Script: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (added xo-info script, CC info on all scripts.)
m (Added xo-builds)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RightTOC}}
{{RightTOC}}


Various bash and other scripts, frequently used.
=== Various bash scripts, frequently used. ===
: (All submitted under CC-BY-SA-NC 3.0 license)
: (I know bash not python, so if you want to offer python versions, please send them my way. :)


; Notes:
== xo-info ==
* I know bash not python, so if you want to offer python versions, please send them my way. :)
Summary
* After creating the script, the 'x' execute bit must be set, 'chmod x+a FILENAME'.
* Quickly display various useful troubleshooting information about the XO Laptop
* All submitted under CC-GNU GPL 3.0 license. {{CC-GNU-GPL}}
* Other than OLPC / XO Laptop uses, if you are going to make some money with this, please let me know.


; Suggestions:
Description
* Put all scripts in /home/olpc/bin directory
* Duickly display various useful troubleshooting information about the XO Laptop
* add directory to your search path. In .bashrc put ' set path="/home/olpc/bin:$PATH" '
* Shows current os version: /etc/issue /boot/olpc_build
* Shows available os versions /versions/pristine/*/boot/olpc_build
* Show available os hash info
** /versions/running /versions/boot
** /versions/* /versions/contents/* /versions/pristine/* /versions/configs/*


== [[/xo-sysinfo|xo-sysinfo]] ==
Benefits
{{/xo-sysinfo}}
* Show both versions (current and alt-boot) of OS installed on the system


== [[/get-xo|get-xo]] ==
{{/get-xo}}


== [[/xo-backup-server|xo-backup-server]] ==
#!/usr/bin/bash
{{/xo-backup-server}}
#### FILE: xo-info ########
# 2008 01 12, Iain Davidson, xo AT myna DOT ws
## RELEASED under CC-BY-SA-NC 3.0 license.
grep -v "garbage-to-ignore" /etc/issue /boot/olpc_build /versions/pristine/*/boot/olpc_build
ls -Ld /versions/* /versions/contents/* /versions/pristine/* /versions/configs/*
ls -ld /versions/running /versions/boot


== [[/xo-builds|xo-builds]] ==
{{/xo-builds}}


== get-xo ==
== [[/xo-update|xo-update]] ==
{{/xo-update}}
Summary
* Get a local copy/backup of your XO Laptop


== [[/xo-update|xo-update-log]] ==
Description
{{/xo-update}}


== See Also ==
* From server (or any other computer), backup copy files from XO Laptop.
* My [[../Project|Activity projects]] .
* Script can ran multiple times, will only copy over files which have changed.

Benefits

* Allows examination of files on different machine, with better local tools and resources.
* run between operations on the XO, to see files created or updated.

#!/usr/bin/bash
#### FILE: get-xo ########
# 2008 01 12, Iain Davidson, xo AT myna DOT ws
## RELEASED under CC-BY-SA-NC 3.0 license.
rsync --verbose --progress --times --perms --recursive --compress --links --rsh="ssh" \
olpc@192.168.0.12:/home /home/Downloads/OLPC-BACKUP
NOTES:
: Command is one single line.
: '192.168.0.12' is the IP address of the OLPC XO Laptop.
: Must setup password for '''olpc''' account


== log-update ==
Summary
* Do an olpc-update to specific build (joyride or Update), log results.

Description
* Log various system information during an olpc-update for later examination

Benefits

* Creates permanent record and timing of update, for later viewing.

First script:


#!/bin/bash
## FILE: log-update ######
# 2008 01 10, Iain Davidson, xo AT myna DOT ws
## RELEASED under CC-BY-SA-NC 3.0 license.
ver="update.1-681"
cd ~olpc
echo "------- $ver -------------------------------------"
date
# Below is various system information nice to log before the update
# (aka xo-info)
grep -v "garbage-to-ignore" /etc/issue /boot/olpc_build
ls -Ld /versions/* /versions/contents/* /versions/pristine/* /versions/configs/*
ls -ld /versions/running /versions/boot
#
/usr/sbin/olpc-update $ver
#
date
echo "------- ______________________ $ver"


Second script:

#!/bin/bash
## FILE: log-update-capture #######
# 2008 01 12, Iain Davidson, xo AT myna DOT ws
## RELEASED under CC-BY-SA-NC 3.0 license.
cd ~olpc
./log-update >>log-update.out 2>>log-update.out



NOTES:
: Assumed that scripts are in /home/olpc , both have 'x' execute bit set.
: Currently need to set manually the version number to update, future feature is passing it along, or picking from list (or latest).

Latest revision as of 03:43, 16 April 2008


Various bash scripts, frequently used.

Notes
  • I know bash not python, so if you want to offer python versions, please send them my way. :)
  • After creating the script, the 'x' execute bit must be set, 'chmod x+a FILENAME'.
  • All submitted under CC-GNU GPL 3.0 license.


Cc-GPL-a.png
This software is licensed under the CC-GNU GPL.


  • Other than OLPC / XO Laptop uses, if you are going to make some money with this, please let me know.
Suggestions
  • Put all scripts in /home/olpc/bin directory
  • add directory to your search path. In .bashrc put ' set path="/home/olpc/bin:$PATH" '

xo-sysinfo

  • xo-sysinfo: Quickly display various useful troubleshooting build information about the XO Laptop


get-xo

  • get-xo: Get a local copy/backup of your XO Laptop /home/olpc directory.


xo-backup-server

  • xo-backup-server: For OLPC/XO-1 Laptop, create a copy/backup of your XO Laptop /home/olpc directory to a specific computer (i.e. server).


xo-builds

Pencil.png NOTE: The contents of this page are not set in stone, and are subject to change!

This page is a draft in active flux ...
Please leave suggestions on the talk page.

Pencil.png
#!/bin/bash
#  FILE: xo-builds
#  DESC: list all possibile builds for olpc-update
#  AUTHOR: Ixo on wiki.laptop.org and irc #olpc-support
#  REV: 2008 02 01, 
date
rsync rsync://updates.laptop.org

xo-update

  • xo-update (& log): Do an olpc-update to specific build (joyride or Update), log results.


xo-update-log

  • xo-update (& log): Do an olpc-update to specific build (joyride or Update), log results.


See Also