Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Oberon/A2/myaos

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

#!/bin/bash # A script to start UnixAos or repository based A2 with a working # directory which can be in a removable flash store. # A flash store is accommodated in multiple machines by copying # machine specific configurations into Configuration.XML and # Oberon.Text. # # Conditions for this script to work. # * The volume containing the working files has a reliable name. # The names in /dev/disk/by-label/ and /dev/disk/by-uuid/ # are convenient. For example, a volume labeled A will appear # as /dev/disk/by-label/A. Additional details here. # https://wiki.archlinux.org/title/Persistent_block_device_naming # Udev in Wikipedia. # * Mounting of the working volume is specified in /etc/fstab. # What if the volume is automounted at a second location? # If edit conflict is avoided, a second mount is probably harmless. # * The following assignments to workingVolume and workingDirectory # are consistent with preceding information. # * An appropriate entry exists in /etc/fstab. Example. # /dev/A /home/me/A ext2 defaults,user,users,exec,noauto 0 0 # * /etc/sudoers.d/sudoers is adjusted to allow the user to fsck the # working filesystem. # me mycomputer = NOPASSWD: /sbin/fsck # Test fsck interactively. # * If the working volume is removeable the user can mount it. # Note the user option in /etc/fstab. # * Prior to revision.10272, aos attempts to create the link # <workingDirectory>/.aoshome to /usr/aos but the FAT file system # doesn't provide links. Resolved by reformatting to ext2. # Ext2 in Wikipedia. # # This is the home part of the system drive. #workingVolume=/dev/sda5 # This is a SD card. #workingVolume=/dev/disk/by-uuid/65b50b9d-5256-4a06-b48b-2425d266387c # This is the stainless steel Kingston USB store. workingVolume=/dev/disk/by-partuuid/d59b8686-03 echo "workingVolume is $workingVolume." # workingDirectory=/home/root/A #workingDirectory=/home/root/Backup echo "workingDirectory=$workingDirectory." # # For UnixAOS preceding revision.10272. #startScript=/usr/bin/aos # For UnixAOS revision.10272. #startScript=/usr/local/bin/a2 # For repository based A2. # startScript=<somewhere>/<repository>/<system>/<script> startScript=/home/root/A/A2/Linux64/a2.sh echo "startScript=$startScript." # # For any hostname violating Oberon file name syntax, make a conformant name. # https://tldp.org/LDP/abs/html/testconstructs.html if [[ $(hostname) = xo-53-1d-bb* ]]; then h="xo" elif [[ $(hostname) = joule* ]]; then h="joule" # Add more cases here. else h=$(hostname --short) fi echo "Shortened hostname, h = $h" A2 () { contextDir=$PWD cd $workingDirectory echo "Switched to working directory." if test -f Configuration.$h.XML then echo "Copying Configuration.$h.XML to Configuration.XML." /bin/cp Configuration.$h.XML Configuration.XML if test -f Oberon.$h.Text then echo "Copying Oberon.$h.Text to Oberon.Text." /bin/cp Oberon.$h.Text Oberon.Text /bin/rm --force --verbose AOS*.Log /bin/rm --force --verbose Trap*.txt /bin/rm --force --verbose .tmp.* echo "Starting system." $startScript else echo "Oberon.$h.Text not present in $workingDirectory. Aborting." fi else echo "Configuration.$h.XML not present in $workingDirectory. Aborting." fi cd $contextDir } if test -b $workingVolume then if findmnt -rn $workingVolume then echo "Working volume is mounted." A2 else echo "Working volume is not mounted." if /sbin/fsck -p $workingVolume then echo "Filesystem in $workingVolume passed fsck." # The mount is specified in /etc/fstab. mount -v $workingVolume A2 else echo "fsck found a problem in $workingVolume and attempted repair. Try again." fi fi else echo "$workingVolume containing working files not connected. Aborting." fi