This file is indexed.

/usr/share/checkbox/scripts/optical_write_test is in checkbox 0.13.7.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
#!/bin/bash

OPTICAL_DRIVE=$(readlink -f $1)
TEMP_DIR='/tmp/optical-test'
ISO_NAME='optical-test.iso'
SAMPLE_FILE_PATH='/usr/share/example-content/'
SAMPLE_FILE='Ubuntu_Free_Culture_Showcase'
MD5SUM_FILE='optical_test.md5'
START_DIR=$PWD

create_working_dirs(){
    # First, create the temp dir and cd there
    echo "Creating Temp directory and moving there ..."
    mkdir -p $TEMP_DIR || return 1
    cd $TEMP_DIR
    echo "Now working in $PWD ..."
    }

get_sample_data(){
    # Get our sample files
    echo "Getting sample files from $SAMPLE_FILE_PATH ..."
    cp -a $SAMPLE_FILE_PATH/$SAMPLE_FILE $TEMP_DIR
    return $?
}

generate_md5(){
    # Generate the md5sum
    echo "Generating md5sums of sample files ..."
    CUR_DIR=$PWD
    cd $SAMPLE_FILE
    md5sum * > $TEMP_DIR/$MD5SUM_FILE
    # Check the sums for paranoia sake
    check_md5 $TEMP_DIR/$MD5SUM_FILE
    rt=$?
    cd $CUR_DIR
    return $rt
}

check_md5(){
    echo "Checking md5sums ..."
    md5sum -c $1
    return $?
}

generate_iso(){
    # Generate ISO image
    echo "Creating ISO Image ..."
    genisoimage -r -J -o $ISO_NAME $SAMPLE_FILE
    return $?
}

burn_iso(){
    #Burn the ISO with wodim
    echo "Sleeping 10 seconds in case drive is not yet ready ..."
    sleep 10
    echo "Beginning image burn ..."
    wodim -eject dev=$OPTICAL_DRIVE $ISO_NAME
    rt=$?
    return $rt
}

check_disk(){
    echo "Sleeping 15 seconds to allow drive to settle"
    sleep 15
    echo "Deleting original data files ..."
    rm -rf $SAMPLE_FILE
    if [ ! -z "$(mount | grep $OPTICAL_DRIVE)" ]; then
        MOUNT_PT=$(mount | grep $OPTICAL_DRIVE | awk '{print $3}')
        echo "Disk is already mounted to $MOUNT_PT"
    else
        MOUNT_PT=$TEMP_DIR/mnt
        echo "Creating temp mount point: $MOUNT_PT ..."
        mkdir $MOUNT_PT
        echo "Mounting disk to mount point ..."
        mount $OPTICAL_DRIVE $MOUNT_PT
    fi
    echo "Copying files from ISO ..."
    cp $MOUNT_PT/* $TEMP_DIR
    check_md5 $MD5SUM_FILE
    return $?
}

cleanup(){
    echo "Moving back to original location"
    cd $START_DIR
    echo "Now residing in $PWD"
    echo "Cleaning up ..."
    umount $MOUNT_PT
    rm -fr $TEMP_DIR
    echo "Ejecting spent media ..."
    eject $OPTICAL_DRIVE
}

failed(){
    echo $1
    echo "Attempting to clean up ..."
    cleanup
    exit 1
}

create_working_dirs || failed "Failed to create working directories"
get_sample_data || failed "Failed to copy sample data"
generate_md5 || failed "Failed to generate initial md5"
generate_iso || failed "Failed to create ISO image"
burn_iso || failed "Failed to burn ISO image"
check_disk || failed "Fiiles from Disk did not checksum"
cleanup || failed "Failed to clean up"
exit 0