User:Ixo/Script: Difference between revisions
< User:Ixo
Jump to navigation
Jump to search
IainDavidson (talk | contribs) (Various scripts I use with my XO Laptop.) |
IainDavidson (talk | contribs) m (added xo-info script, CC info on all scripts.) |
||
Line 4: | Line 4: | ||
: (All submitted under CC-BY-SA-NC 3.0 license) |
: (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. :) |
: (I know bash not python, so if you want to offer python versions, please send them my way. :) |
||
== xo-info == |
|||
Summary |
|||
* Quickly display various useful troubleshooting information about the XO Laptop |
|||
Description |
|||
* Duickly display various useful troubleshooting information about the XO Laptop |
|||
* 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/* |
|||
Benefits |
|||
* Show both versions (current and alt-boot) of OS installed on the system |
|||
#!/usr/bin/bash |
|||
#### 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 |
|||
== get-xo == |
== get-xo == |
||
Line 17: | Line 43: | ||
* Allows examination of files on different machine, with better local tools and resources. |
* 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 |
#!/usr/bin/bash |
||
Line 48: | Line 74: | ||
#!/bin/bash |
#!/bin/bash |
||
## FILE: log-update |
## FILE: log-update ###### |
||
# 2008 01 10, Iain Davidson, xo AT myna DOT ws |
# 2008 01 10, Iain Davidson, xo AT myna DOT ws |
||
## RELEASED under CC-BY-SA-NC 3.0 license. |
|||
ver="joyride-1530" |
|||
ver="update.1-681" |
|||
cd ~olpc |
cd ~olpc |
||
echo "------- |
echo "------- $ver -------------------------------------" |
||
date |
date |
||
# Below is various system information nice to log before the update |
# Below is various system information nice to log before the update |
||
# (aka xo-info) |
|||
grep -v "garbage-to-ignore" /etc/issue /boot/olpc_build |
grep -v "garbage-to-ignore" /etc/issue /boot/olpc_build |
||
ls -Ld /versions/* /versions/contents/* /versions/pristine/* /versions/configs/* |
ls -Ld /versions/* /versions/contents/* /versions/pristine/* /versions/configs/* |
||
Line 68: | Line 96: | ||
#!/bin/bash |
#!/bin/bash |
||
## FILE: log-update-capture |
## FILE: log-update-capture ####### |
||
# 2008 01 |
# 2008 01 12, Iain Davidson, xo AT myna DOT ws |
||
## RELEASED under CC-BY-SA-NC 3.0 license. |
|||
cd ~olpc |
cd ~olpc |
||
./log-update >>log-update.out 2>>log-update.out |
./log-update >>log-update.out 2>>log-update.out |
Revision as of 01:09, 15 January 2008
Various bash and other 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. :)
xo-info
Summary
- Quickly display various useful troubleshooting information about the XO Laptop
Description
- Duickly display various useful troubleshooting information about the XO Laptop
- 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/*
Benefits
- Show both versions (current and alt-boot) of OS installed on the system
#!/usr/bin/bash #### 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
get-xo
Summary
- Get a local copy/backup of your XO Laptop
Description
- From server (or any other computer), backup copy files from XO Laptop.
- 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).