File jeos-firstboot-1.0.0.obscpio of Package jeos-firstboot
07070100000000000081A4000003E8000000640000000160378A7B00000421000000000000000000000000000000000000001D00000000jeos-firstboot-1.0.0/LICENSECopyright (c) 2015-2016 SUSE LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
07070100000001000081A4000003E8000000640000000160378A7B000000B9000000000000000000000000000000000000001C00000000jeos-firstboot-1.0.0/READMEThis is a lightweight, dialog based firstboot wizard that replaces
systemd's line based firstboot program. It can show the license and
prompt for language, keyboard and root passsword.
07070100000002000041ED000003E8000000640000000360378A7B00000000000000000000000000000000000000000000001B00000000jeos-firstboot-1.0.0/files07070100000003000041ED000003E8000000640000000560378A7B00000000000000000000000000000000000000000000001F00000000jeos-firstboot-1.0.0/files/usr07070100000004000041ED000003E8000000640000000360378A7B00000000000000000000000000000000000000000000002300000000jeos-firstboot-1.0.0/files/usr/lib07070100000005000041ED000003E8000000640000000360378A7B00000000000000000000000000000000000000000000002B00000000jeos-firstboot-1.0.0/files/usr/lib/systemd07070100000006000041ED000003E8000000640000000260378A7B00000000000000000000000000000000000000000000003200000000jeos-firstboot-1.0.0/files/usr/lib/systemd/system07070100000007000081A4000003E8000000640000000160378A7B0000040B000000000000000000000000000000000000005200000000jeos-firstboot-1.0.0/files/usr/lib/systemd/system/jeos-firstboot-snapshot.service[Unit]
Description=SUSE JeOS First Boot Wizard - create system snapshot
# Same as YaST2-Firstboot.service here
After=apparmor.service local-fs.target plymouth-start.service YaST2-Second-Stage.service
Conflicts=plymouth-start.service
Before=getty@tty1.service serial-getty@ttyS0.service serial-getty@ttyS1.service serial-getty@ttyS2.service
Before=display-manager.service
ConditionPathExists=/var/lib/YaST2/reconfig_system
# The configuration is already done - so this doesn't make much sense
#OnFailure=poweroff.target
# jeos-firstboot-snapshot starts after jeos-firstboot, time got synced
# and dbus became available
Wants=time-sync.target
Requires=jeos-firstboot.service dbus.service
After=jeos-firstboot.service time-sync.target
[Service]
Type=oneshot
RemainAfterExit=yes
# In Pre - if creation fails, don't do the configuration again
ExecStartPre=/usr/bin/rm -f /var/lib/YaST2/reconfig_system
ExecStart=/usr/sbin/jeos-firstboot-snapshot
StandardOutput=tty
StandardInput=tty
#StandardError=tty
[Install]
WantedBy=default.target
07070100000008000081A4000003E8000000640000000160378A7B00000580000000000000000000000000000000000000004900000000jeos-firstboot-1.0.0/files/usr/lib/systemd/system/jeos-firstboot.service# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=SUSE JeOS First Boot Wizard
# Same as YaST2-Firstboot.service here
After=apparmor.service local-fs.target plymouth-start.service YaST2-Second-Stage.service
Conflicts=plymouth-start.service
Before=getty@tty1.service serial-getty@ttyS0.service serial-getty@ttyS1.service serial-getty@ttyS2.service
Before=display-manager.service
ConditionPathExists=/var/lib/YaST2/reconfig_system
OnFailure=poweroff.target
# jeos-firstboot starts before network and login though
Before=network.service systemd-user-sessions.service
# The existence of this file reflects whether cloud-init's systemd-generator enables cloud-init.
# If it does not exist, cloud-init won't run, so it's our turn.
ConditionPathExists=!/run/cloud-init/enabled
# jeos-firstboot-snapshot.service deletes the flag file, but starts after us
Wants=jeos-firstboot-snapshot.service
[Service]
Type=oneshot
Environment=TERM=linux
RemainAfterExit=yes
ExecStartPre=/bin/sh -c "/usr/bin/plymouth quit 2>/dev/null || :"
ExecStart=/usr/sbin/jeos-firstboot
StandardOutput=tty
StandardInput=tty
#StandardError=tty
[Install]
WantedBy=default.target
07070100000009000041ED000003E8000000640000000260378A7B00000000000000000000000000000000000000000000002400000000jeos-firstboot-1.0.0/files/usr/sbin0707010000000A000081ED000003E8000000640000000160378A7B00000DEF000000000000000000000000000000000000003000000000jeos-firstboot-1.0.0/files/usr/sbin/jeos-config#!/bin/bash
# Copyright (c) 2020 SUSE LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
. /etc/os-release
. "/usr/share/jeos-firstboot/jeos-firstboot-functions"
. "/usr/share/jeos-firstboot/jeos-firstboot-dialogs"
# for testing we may run as non root
if [ -w /run ]; then
export TMPDIR=/run
# debugging
if [ -n "$FIRSTBOOT_DEBUG" ]; then
set -x
exec 2>/var/log/firstboot-debug
fi
else
dry=1
fi
if [ -n "$dry" ]; then
run() {
echo "$@"
}
else
run() {
"$@"
}
fi
cleanup() {
#call_module_hook cleanup
echo .oOo.oOo.oOo. > $dialog_out
rm -f "$dialog_out"
# reenable systemd and kernel logs
echo
}
trap cleanup EXIT
select_config()
{
modules_order=("locale" '' "keytable" '' "timezone" '' "password" '' "network" '')
for module in "${modules[@]}"; do
modules_order+=("${module}" '')
done
d --menu $"Select configuration module" 0 0 $dh_menu "${modules_order[@]}"
}
usage()
{
cat <<EOF
Usage: jeos-config [OPTION...] [CONFIG_NAME]
Configure system settings using an interactive dialog
-h shows this usage help
locale Show configuration for locale
keytable Show configuration for keyboard
timezone Show configuration for timezone
password Show configuration for password
network Show configuration for network
$(for module in "${modules[@]}"; do
echo " ${module} Show configuration for ${module}"
done)
EOF
}
while getopts ":h" opt; do
case ${opt} in
h)
usage
exit 0
;;
\?)
echo "Invalid Option: -$OPTARG" 1>&2
usage
exit 1
;;
esac
done
if [ ${OPTIND} -gt $# ]; then
select_config
subcommand=${result}
else
subcommand=${!OPTIND}; shift
fi
case "$subcommand" in
locale)
list=() # Set by findlocales
if ! findlocales; then
d --msgbox $"No locales found" 0 0
elif [ "${#list[@]}" -eq 2 ]; then # Only a single entry
d --msgbox $"Locale set to ${list[0]}, no more locales available" 5 50
else
dialog_locale
apply_locale
fi
;;
keytable)
dialog_keytable
JEOS_LOCALE="$(get_current_locale)"
apply_locale_and_keytable
;;
timezone)
dialog_timezone
timedatectl set-timezone "$JEOS_TIMEZONE"
;;
network)
if ! d --yesno $"This will create a new network configuration from scratch,
all connections will be lost.\nDo you want to continue?" 7 50; then
exit 0
fi
dialog_network
d --infobox $"Restarting network ..." 3 26 || true
systemctl restart network
;;
password)
dialog_password
apply_password
;;
*)
call_module "$subcommand" "jeos_config" || echo "Unknown option '$subcommand'"
esac
0707010000000B000081ED000003E8000000640000000160378A7B00001BB6000000000000000000000000000000000000003300000000jeos-firstboot-1.0.0/files/usr/sbin/jeos-firstboot#!/bin/bash
# Copyright (c) 2015 SUSE LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -e
TEXTDOMAIN='jeos-firstboot'
. /etc/os-release
. "/usr/share/jeos-firstboot/jeos-firstboot-functions"
. "/usr/share/jeos-firstboot/jeos-firstboot-dialogs"
# Read the optional configuration file
[ -f /usr/share/defaults/jeos-firstboot.conf ] && . /usr/share/defaults/jeos-firstboot.conf
[ -f /etc/jeos-firstboot.conf ] && . /etc/jeos-firstboot.conf
# for testing we may run as non root
if [ -w /run ]; then
export TMPDIR=/run
# debugging
if [ -n "$FIRSTBOOT_DEBUG" ]; then
set -x
exec 2>/var/log/firstboot-debug
fi
else
dry=1
fi
if [ -n "$dry" ]; then
run() {
echo "$@"
}
else
run() {
"$@"
}
fi
cleanup() {
call_module_hook cleanup
echo .oOo.oOo.oOo. > $dialog_out
rm -f "$dialog_out"
# reenable systemd and kernel logs
# Try the race-free DBus method first
if ! run dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 \
org.freedesktop.systemd1.Manager.SetShowStatus string: &>/dev/null; then
# Fall back to using signals
run kill -s SIGRTMAX-10 1
fi
run setterm -msg on 2>/dev/null || true
echo
}
trap cleanup EXIT
# avoid kernel messages spamming our console
run setterm -msg off 2>/dev/null || true
# Avoid systemd messages spamming our console
# Try the race-free DBus method first
if ! run dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 \
org.freedesktop.systemd1.Manager.SetShowStatus string:off &>/dev/null; then
# Fall back to using signals
run kill -s SIGRTMAX-9 1
# sleep to avoid systemd bug, bsc#1119382
sleep 1
fi
systemd_firstboot_args=('--setup-machine-id')
# If the configuration is not loaded and we are in the first terminal
# instance, make sure that the variables are declared.
JEOS_LOCALE=${JEOS_LOCALE-}
JEOS_KEYTABLE=${JEOS_KEYTABLE-}
if [ -z "$JEOS_LOCALE" ]; then
dialog_locale
fi
# Activate the locale selected
apply_locale
# also add to systemd-firstboot parameters
systemd_firstboot_args+=("--locale=$JEOS_LOCALE")
if [ -z "$JEOS_KEYTABLE" ]; then
dialog_keytable
fi
# langset.sh needs locale to set keytable
apply_locale_and_keytable
[ -n "$JEOS_LOCALE" ] && language="${JEOS_LOCALE%%_*}" || language="en"
force_english_license=0
export LANG="$JEOS_LOCALE"
kmscon_available() {
# kmscon itself is installed
kmscon --help >/dev/null 2>&1 || return 1
# At least one monospace font is available
[ -n "$(fc-match "monospace" 2>/dev/null)" ] || return 1
return 0
}
fbiterm_available() {
# fbiterm itself is installed
fbiterm --help >/dev/null 2>&1 || return 1
# fbiterm comes with its own fallback font
return 0
}
if [[ "$(ps h -o tty -p $$)" = tty[0-9]* ]]; then
# Those languages can't be displayed in the console
declare -A start_kmscon
start_kmscon["cs"]=1
start_kmscon["ja"]=1
start_kmscon["zh"]=1
start_kmscon["ko"]=1
# Relay those settings to the nested instance
export JEOS_LOCALE JEOS_KEYTABLE
if [ -n "$JEOS_LOCALE" -a -n "${start_kmscon[${language}]+_}" ]; then
if kmscon_available; then
ret_file="$(mktemp)"
kmscon --silent --font-size 10 --palette vga --no-reset-env -l -- /bin/sh -c "$0; echo \$? > $ret_file; kill \$PPID"
exit $(cat "$ret_file"; rm -f "$ret_file")
elif fbiterm_available; then
exec fbiterm -- "$0"
else
# No kmscon or fbiterm, fall back to english
export LANG="en_US.UTF-8"
force_english_license=1
fi
fi
fi
if [ -z "$JEOS_EULA_ALREADY_AGREED" ]; then
# Find the location of the EULA
# An EULA in /etc takes precedence
EULA_FILE=/etc/YaST2/licenses/base/license.txt
[ -e "${EULA_FILE}" ] || EULA_FILE=/usr/share/licenses/product/base/license.txt
# Failsafe: If no license found, quit.
if ! [ -e "$EULA_FILE" ]; then
d --msgbox $"No license found - cannot continue" 6 40
exit 1
fi
if [ "$force_english_license" = "0" ]; then
for i in "${EULA_FILE%.txt}.${JEOS_LOCALE}.txt" \
"${EULA_FILE%.txt}.${JEOS_LOCALE%%.UTF-8}.txt" \
"${EULA_FILE%.txt}.${language}.txt"; do
if [ -e "$i" ]; then
EULA_FILE="$i"
break
fi
done
fi
while ! dialog --backtitle "$PRETTY_NAME" --textbox "$EULA_FILE" $dh_text 85 --and-widget --yesno $"Do you agree with the terms of the license?" 0 0; do
d --msgbox $"Can not continue without agreement" 6 40
done
fi
if [ -z "$JEOS_TIMEZONE" ]; then
dialog_timezone
fi
systemd_firstboot_args+=("--timezone=$JEOS_TIMEZONE")
# systemd-firstboot does not set the timezone if it exists, langset.sh created it
run rm -f /etc/localtime
run systemd-firstboot "${systemd_firstboot_args[@]}"
if [ -z "$JEOS_PASSWORD_ALREADY_SET" ]; then
dialog_password
fi
# Do not show the register on non SLE based distributions or if is
# globally disabled
if [ -x /usr/bin/SUSEConnect -a -z "${ID##sle*}" -a -z "${JEOS_HIDE_SUSECONNECT}" ]; then
d --msgbox $"Please register this image using your existing SUSE entitlement.
As \"root\" use the following command:
SUSEConnect -e company@example.com -r YOUR_CODE
to register the instance with SCC
Without registration this instance does not have access to updates and
security fixes." 0 0 || true
fi
## Configure initial network settings
dialog_network
call_module_hook systemd_firstboot
d --infobox $"Applying firstboot settings ..." 3 40 || true
apply_password
# Look for EFI dir to see if the machine is booted in UEFI mode
EFI_SYSTAB="/sys/firmware/efi/systab"
# modprobe and efivars are not available everywhere, just ignore those cases
run modprobe efivars &>/dev/null || true
if ! [ -f "$EFI_SYSTAB" ]; then
if [ -f /etc/sysconfig/bootloader ]; then
run sed -i -e "s/LOADER_TYPE=.*/LOADER_TYPE=grub2/g" /etc/sysconfig/bootloader
fi
fi
# Test if snapper is available
if [ -x /usr/bin/snapper -a "$(stat --format=%T -f /)" = "btrfs" ]; then
if ! btrfs qgroup show / &>/dev/null; then
# Run snapper to setup quota for btrfs
run /usr/bin/snapper --no-dbus setup-quota || warn $"Could not setup quota for btrfs"
fi
fi
call_module_hook post
0707010000000C000081ED000003E8000000640000000160378A7B000005AB000000000000000000000000000000000000003C00000000jeos-firstboot-1.0.0/files/usr/sbin/jeos-firstboot-snapshot#!/bin/bash
#
# Copyright (c) 2019 SUSE LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -euo pipefail
if ! mountpoint /.snapshots &>/dev/null; then
echo "Snapshots not enabled, skipping"
exit 0
fi
if [ ! -e /.snapshots/2 ]; then
snapper -v create -d "After jeos-firstboot configuration" --userdata "important=yes"
fi
if [ -x /usr/lib/snapper/plugins/grub ]; then
/usr/lib/snapper/plugins/grub --refresh
fi
exit 0
0707010000000D000041ED000003E8000000640000000460378A7B00000000000000000000000000000000000000000000002500000000jeos-firstboot-1.0.0/files/usr/share0707010000000E000041ED000003E8000000640000000260378A7B00000000000000000000000000000000000000000000002E00000000jeos-firstboot-1.0.0/files/usr/share/defaults0707010000000F000081A4000003E8000000640000000160378A7B000004A3000000000000000000000000000000000000004200000000jeos-firstboot-1.0.0/files/usr/share/defaults/jeos-firstboot.conf# Example configuration file for jeos-firstboot
# Valid system locale that will be used in JeOS. If empty/unset, a
# dialog box will ask for the system locale.
# JEOS_LOCALE='en_US'
# Keyboard layout used in the system and during jeos-firstboot.
# If empty/unset, a dialog box will ask for the keyboard layout.
# JEOS_KEYTABLE='en'
# Local timezone of the system.
# If empty/unset, a dialog box will ask for the local timezone.
# JEOS_TIMEZONE='UTC'
# If set to a nonempty value, the dialog box for setting the
# initial password for the root user will be skipped. In this case is
# expected that the root password was set by other means.
# JEOS_PASSWORD_ALREADY_SET='yes'
# If set to a nonempty value, the dialog box for accepting the EULA
# will be skipped. Use this option only when building images (ISO /
# PXE / OEM) that are part of another product and than can be used
# when this license was already accepted by other means.
# JEOS_EULA_ALREADY_AGREED='yes'
# If set to a nonempty value, the dialog box for showing the
# SUSEConnect help will not be displayed. By default this dialog is
# present when SUSEConnect is installed on SLE systems.
# JEOS_HIDE_SUSECONNECT='yes'
07070100000010000041ED000003E8000000640000000360378A7B00000000000000000000000000000000000000000000003400000000jeos-firstboot-1.0.0/files/usr/share/jeos-firstboot07070100000011000081A4000003E8000000640000000160378A7B00000DAD000000000000000000000000000000000000004B00000000jeos-firstboot-1.0.0/files/usr/share/jeos-firstboot/jeos-firstboot-dialogsmenulist()
{
list=()
local line
while read line; do
list+=("$line" '')
done < <("$@"||true)
[ -n "$list" ]
}
dialog_locale()
{
default="en_US"
[ -f /etc/locale.conf ] && locale_lang="$(awk -F= '$1 == "LANG" { split($2,fs,"."); print fs[1]; exit }' /etc/locale.conf)"
[ -n "$locale_lang" ] && default="$locale_lang"
list=() # Set by findlocales
newlocale="$default"
if ! findlocales; then
d --msgbox $"No locales found" 0 0
elif [ "${#list[@]}" -eq 2 ]; then # Only a single entry
newlocale="${list[0]}"
else
d --default-item "$default" --menu $"Select system locale" 0 0 $dh_menu "${list[@]}"
newlocale="${result}"
fi
JEOS_LOCALE="${newlocale}.UTF-8"
}
dialog_keytable()
{
default="us"
[ -f /etc/vconsole.conf ] && vconsole_keymap="$(awk -F= '$1 == "KEYMAP" { split($2,fs,"."); print fs[1]; exit }' /etc/vconsole.conf)"
[ -n "$vconsole_keymap" ] && default="$vconsole_keymap"
if findkeymaps \
&& d --default-item "$default" --menu $"Select keyboard layout" 0 0 $dh_menu "${list[@]}"; then
if [ -n "$result" ]; then
JEOS_KEYTABLE="$result"
fi
else
d --msgbox $"Error setting keyboard" 5 26
fi
}
dialog_timezone()
{
default="$(readlink -f /etc/localtime)"
default="${default##/usr/share/zoneinfo/}"
# timedatectl doesn't work as dbus is not up yet
# menulist timedatectl --no-pager list-timezones
if menulist awk \
'BEGIN{print "UTC"; sort="sort"}/^#/{next;}{print $3|sort}END{close(sort)}' \
/usr/share/zoneinfo/zone.tab \
&& d --default-item "$default" --menu $"Select time zone" 0 0 $dh_menu "${list[@]}"; then
if [ -n "$result" ]; then
JEOS_TIMEZONE="$result"
fi
else
d --msgbox $"Error setting timezone" 5 26
fi
}
dialog_password()
{
while true; do
d --insecure --passwordbox $"Enter root password" 0 0
password="$result"
d --insecure --passwordbox $"Confirm root password" 0 0
if [ "$password" != "$result" ]; then
d --msgbox $"Entered passwords don't match" 5 40
continue
fi
if [ -z "$password" ]; then
warn $"Warning: No root password set.
You cannot log in that way. A debug shell will be started on tty9 just this time. Use it to e.g. import your ssh key." 0 0 || true
run systemctl start debug-shell.service
fi
break
done
}
dialog_network()
{
d --infobox $"Collecting network info ..." 3 33
shopt -s nullglob
for net_path in /sys/class/net/* ; do
test -f "$net_path" && continue # skip bonding_masters file
# Only devices having ID_NET_NAME.* attrs
# Ignore errors if udev not available
udevadm info -q property -p "$net_path" 2>/dev/null | grep -qs ID_NET_NAME || continue
# But don't touch WLAN interfaces
udevadm info -q property -p "$net_path" | grep -qs "DEVTYPE=wlan" && continue
net_device=${net_path##*/}
unset IPADDR
eval `wicked test dhcp4 "$net_device" 2>/dev/null | grep -E "^IPADDR="`
ip link set down "$net_device" # set link down after probe once done
# Create a configuration file for each interface that provides
# an IPADDR
if [ -n "$IPADDR" ]; then
printf "STARTMODE=auto\nBOOTPROTO=dhcp\n" \
> "/etc/sysconfig/network/ifcfg-$net_device"
fi
done
run sed -i -E 's/^DHCLIENT(6?)_SET_HOSTNAME=.*$/DHCLIENT\1_SET_HOSTNAME=yes/' /etc/sysconfig/network/dhcp
}
# vim: syntax=sh
07070100000012000081A4000003E8000000640000000160378A7B00000E93000000000000000000000000000000000000004D00000000jeos-firstboot-1.0.0/files/usr/share/jeos-firstboot/jeos-firstboot-functionsstty_size() {
set -- `stty size`; LINES=$1; COLUMNS=$2
# stty size can return zero when not ready or
# its a serial console
if [ "$COLUMNS" = "0" -o "$LINES" = "0" ]; then
LINES=24
COLUMNS=80
fi
}
stty_size
result=
list=
password=''
modules=()
let dh_menu=LINES-15
let dh_text=LINES-5
if pushd "/usr/share/jeos-firstboot/modules" &>/dev/null; then
for module in *; do
if [ -f "${module}" ] && source "${module}"; then
modules+=("${module}")
fi
done
popd &>/dev/null
fi
call_module() {
local module="$1"
local module_func="$2"
module_function="${module}_${module_func}"
[ "$(type -t -- "${module_function}")" = "function" ] || return 1
"${module_function}" && true # To not trigger errexit
ret=$?
[ $ret -eq 0 ] || return $ret
}
call_module_hook() {
local hook="$1"
for module in "${modules[@]}"; do
call_module ${module} ${hook} || continue
done
return 0
}
kmscon_available() {
# kmscon itself is installed
kmscon --help >/dev/null 2>&1 || return 1
# At least one monospace font is available
[ -n "$(fc-match "monospace" 2>/dev/null)" ] || return 1
return 0
}
fbiterm_available() {
# fbiterm itself is installed
fbiterm --help >/dev/null 2>&1 || return 1
# fbiterm comes with its own fallback font
return 0
}
dialog_out=`mktemp -qt 'firstboot-XXXXXX'`
d(){
retval=
while true
do
retval=0
dialog --backtitle "$PRETTY_NAME" --output-fd 3 "$@" 3>"${dialog_out}" || retval=$?
case $retval in
0)
# need || true as dialog doesn't write newlines
read result < $dialog_out || true
return 0
;;
1)
echo "$(xargs -a "$dialog_out")" >/var/log/jeos
dialog --yesno $"Do you really want to quit?" 0 0 && exit 1
continue
;;
255)
# xargs to remove whitespaces
echo "$(xargs -a "$dialog_out")" >/var/log/jeos
result_error="$(xargs -a "$dialog_out")"
if [ -z "$result_error" ]; then
dialog --yesno $"Do you really want to quit?" 0 0 && exit 1
continue
fi
logger -p err -t jeos-firstboot "$result_error"
dialog --msgbox $"Exiting due to error, please check the system log" 0 0
exit 2
;;
esac
done
}
warn(){
d --title $"Warning" --msgbox "$1" 6 40
}
# localectl --no-pager list-keymaps does not list aliases (symlinks), but those are used
# by YaST/langset.sh, so we need to show them.
findkeymaps()
{
list=()
local line
while read line; do
list+=("${line%.map.gz}" '')
done < <(find /usr/share/kbd/keymaps -name '*.map.gz' -printf "%f\n" | sort -u)
[ -n "$list" ]
}
findlocales()
{
list=()
local l locale
# List only locales which are both in live-langset-data and glibc-locale(-base)
for l in /usr/share/langset/*; do
locale="${l#/usr/share/langset/}"
[ -d "/usr/lib/locale/${locale}.utf8" ] || continue
list+=("${locale}" '')
done
[ -n "$list" ]
}
get_current_locale()
{
cur_locale=`awk -F= '$1 == "LANG" { print $2; exit }' /etc/locale.conf`
[ -z "$cur_locale" ] && cur_locale="en_US"
echo ${cur_locale}
}
apply_locale()
{
if [ ! -z "$JEOS_LOCALE" ]; then
run langset.sh $JEOS_LOCALE || warn $"Setting the locale failed"
fi
}
apply_locale_and_keytable()
{
if [ ! -z "$JEOS_LOCALE" -a ! -z "$JEOS_KEYTABLE" ]; then
# Activate the selected keyboard layout
run langset.sh "$JEOS_LOCALE" "$JEOS_KEYTABLE" || warn $"Setting the keyboard layout failed"
fi
}
apply_password()
{
# FIXME: systemd-firstboot doesn't set password if shadow present
if [ -n "$password" ]; then
run echo "root:$password" | run /usr/sbin/chpasswd
fi
}
# vim: syntax=sh
07070100000013000041ED000003E8000000640000000260378A7B00000000000000000000000000000000000000000000003C00000000jeos-firstboot-1.0.0/files/usr/share/jeos-firstboot/modules07070100000014000081A4000003E8000000640000000160378A7B00001231000000000000000000000000000000000000004A00000000jeos-firstboot-1.0.0/files/usr/share/jeos-firstboot/modules/raspberrywifi# Copyright (c) 2019 SUSE LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
config_wireless=false
# Raspberry pi Wi-fi functions
raspberrywifi_get_wlan_devices()
{
list=()
local line
while read line; do
list+=("${line}" '')
done < <(ls -d /sys/class/net/*/wireless | awk -F'/' '{ print $5 }')
[ -n "$list" ]
}
raspberrywifi_get_wlan_networks()
{
list=()
local line
while read line; do
list+=("${line}" '')
done < <(ip link set $wlan_device up && iwlist $wlan_device scan|grep ESSID|cut -d':' -f2|cut -d'"' -f2|sort -u)
[ -n "${list[*]}" ]
}
raspberrywifi_wlan_error()
{
dialog --title $"Error" --yesno $"$1\n\nDo you want to retry?" 0 0
}
is_raspberry()
{
grep -q Raspberry /proc/device-tree/model 2> /dev/null
}
# This function is called as part of jeos-config module hook implementation
# and also used to run the config dialogs for the module itself for
# jeos-firstboot modules extension.
raspberrywifi_jeos_config()
{
while true
do
if ! raspberrywifi_get_wlan_devices; then
if raspberrywifi_wlan_error $"Error listing wlan devices"; then
continue
fi
break
fi
if [ "${#list[@]}" -eq "2" ]; then
wlan_device="${list[0]}"
else
d --menu $"Select wireless card to configure" 0 0 $dh_menu "${list[@]}"
wlan_device="${result}"
fi
if raspberrywifi_get_wlan_networks && d --menu $"Select wireless network to connect" 0 0 $dh_menu "${list[@]}"; then
wlan_network="$result"
else
if raspberrywifi_wlan_error $"Error listing wireless networks"; then
continue
fi
break
fi
d --menu $"Select authentication mode" 0 0 $dh_menu $"WPA-PSK" '' $"WPA-EAP" '' $"Open" ''
wlan_auth_mode="$result"
wlan_auth_mode_conf=
if [ "$wlan_auth_mode" = "WPA-EAP" ]; then
wlan_auth_mode_conf=eap
d --inputbox $"Username" 0 0
wlan_username="$result"
fi
if [ "$wlan_auth_mode" = "WPA-PSK" ]; then
wlan_auth_mode_conf=psk
fi
if [ "$wlan_auth_mode" = "Open" ]; then
wlan_auth_mode_conf=open
fi
if [ "$wlan_auth_mode" != "Open" ]; then
wlan_password=
d --insecure --passwordbox $"Network password" 0 0
wlan_password="$result"
fi
config_file=`mktemp -qt 'firstboot-XXXXXX'`
cat << EOF > $config_file
BOOTPROTO='dhcp'
STARTMODE='auto'
WIRELESS_AP_SCANMODE='1'
WIRELESS_AUTH_MODE='$wlan_auth_mode_conf'
WIRELESS_ESSID='$wlan_network'
WIRELESS_MODE='Managed'
EOF
if [ $wlan_auth_mode = "WPA-PSK" ]; then
echo "WIRELESS_WPA_PSK='$wlan_password'" >> $config_file
fi
if [ $wlan_auth_mode = "WPA-EAP" ]; then
echo "WIRELESS_WPA_IDENTITY='$wlan_username'" >> $config_file
echo "WIRELESS_WPA_PASSWORD='$wlan_password'" >> $config_file
echo "WIRELESS_EAP_AUTH='mschapv2'" >> $config_file
fi
run mv -f $config_file /etc/sysconfig/network/ifcfg-$wlan_device
d --infobox $"Connecting to wireless network ..." 3 38 || true
run ifdown $wlan_device &>/dev/null || true
if ! run ifup $wlan_device &>/dev/null; then
if dialog --yesno $"Connection failed, do you wish to retry?" 0 0; then
continue
fi
fi
return 0
done
}
# This is called by jeos-firstboot for user
# interaction and access to the global systemd_firstboot_args array
raspberrywifi_systemd_firstboot()
{
if is_raspberry && stat -t /sys/class/net/*/wireless &> /dev/null; then
if dialog --yesno $"Configure wireless network?" 0 0; then
config_wireless=true
fi
fi
[ "$config_wireless" = "true" ] || return 0
raspberrywifi_jeos_config
}
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!64 blocks