golang.org/x/build@v0.0.0-20240506185731-218518f32b70/env/dragonfly-amd64/phase3.sh (about)

     1  #!/usr/local/bin/bash
     2  # Copyright 2023 The Go Authors. All rights reserved.
     3  # Use of this source code is governed by a BSD-style
     4  # license that can be found in the LICENSE file.
     5  
     6  
     7  # Phase 3 of the DragonflyBSD installation: apply buildlet customizations.
     8  
     9  set -ex
    10  set -o pipefail
    11  
    12  echo >&2 phase3.sh starting
    13  rm -f /etc/pfi.conf
    14  
    15  # pfi startup does not have full path that a root login does.
    16  export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/pkg/sbin:/usr/pkg/bin:/root/bin
    17  
    18  # Add a gopher user.
    19  pw useradd gopher -g 0 -c 'Gopher Gopherson' -s /bin/sh
    20  
    21  # Disable keyboard console that won't exist on Google Cloud,
    22  # to silence errors about trying to run getty on them.
    23  # Serial console will remain enabled.
    24  perl -pi -e 's/^ttyv/# ttyv/' /etc/ttys
    25  
    26  # Set up buildlet service.
    27  cp /mnt/buildlet /etc/rc.d/buildlet
    28  chmod +x /etc/rc.d/buildlet
    29  
    30  # Update rc.conf to run buildlet.
    31  cat >>/etc/rc.conf <<'EOF'
    32  hostname="buildlet"
    33  rc_info="YES"
    34  rc_startmsgs="YES"
    35  sshd_enable="YES"
    36  buildlet_enable="YES"
    37  buildlet_env="PATH=/bin:/sbin:/usr/bin:/usr/local/bin"
    38  EOF
    39  
    40  # Update loader.conf to disable checksum offload.
    41  cat >>/boot/loader.conf <<'EOF'
    42  hw.vtnet.csum_disable="1"
    43  EOF
    44  
    45  # Generate ssh keys if needed.
    46  service sshd keygen
    47  
    48  echo 'DONE WITH PHASE 3.'
    49  sync
    50  poweroff
    51  sleep 86400