-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #592 from d-loose/no-refresh-on-loading
feat(bootstrap): don't check for updates in `_initInstallerApp`
- Loading branch information
Showing
14 changed files
with
593 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
source "$SNAP_USER_DATA/.last_revision" 2>/dev/null || true | ||
if [ "$SNAP_DESKTOP_LAST_REVISION" = "$SNAP_REVISION" ]; then | ||
needs_update=false | ||
else | ||
needs_update=true | ||
fi | ||
|
||
if [ "$SNAP_ARCH" = "amd64" ]; then | ||
ARCH="x86_64-linux-gnu" | ||
elif [ "$SNAP_ARCH" = "armhf" ]; then | ||
ARCH="arm-linux-gnueabihf" | ||
elif [ "$SNAP_ARCH" = "arm64" ]; then | ||
ARCH="aarch64-linux-gnu" | ||
elif [ "$SNAP_ARCH" = "ppc64el" ]; then | ||
ARCH="powerpc64le-linux-gnu" | ||
else | ||
ARCH="$SNAP_ARCH-linux-gnu" | ||
fi | ||
|
||
# Set cache folder to local path | ||
export XDG_CACHE_HOME="$SNAP_USER_COMMON/.cache" | ||
[ -d "$XDG_CACHE_HOME" ] || mkdir -p "$XDG_CACHE_HOME" | ||
|
||
# Workaround for flickering corners and other graphical glitches with GTK's | ||
# OpenGL backend for X11. See: | ||
# - https://github.com/canonical/ubuntu-desktop-installer/issues/1397 | ||
# - https://gitlab.gnome.org/GNOME/gtk/-/issues/5600 | ||
export GDK_RENDERING=image | ||
|
||
export GDK_PIXBUF_MODULE_FILE="$XDG_CACHE_HOME/gdk-pixbuf-loaders.cache" | ||
export GDK_PIXBUF_MODULEDIR="$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders" | ||
if [ "$needs_update" = true ] || [ ! -f "$GDK_PIXBUF_MODULE_FILE" ]; then | ||
rm -f "$GDK_PIXBUF_MODULE_FILE" | ||
if [ -f "$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders" ]; then | ||
$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders > "$GDK_PIXBUF_MODULE_FILE" | ||
fi | ||
fi | ||
|
||
[ "$needs_update" = true ] && echo "SNAP_DESKTOP_LAST_REVISION=$SNAP_REVISION" > "$SNAP_USER_DATA/.last_revision" | ||
|
||
# Disable storage automounting (/usr/lib/udisks2/udisks2-inhibit) | ||
sudo mkdir -p /run/udev/rules.d | ||
sudo sh -c 'echo "SUBSYSTEM==\"block\", ENV{UDISKS_IGNORE}=\"1\"" > /run/udev/rules.d/90-udisks-inhibit.rules' | ||
trap "sudo rm -f /run/udev/rules.d/90-udisks-inhibit.rules; sudo udevadm control --reload; sudo udevadm trigger --subsystem-match=block" EXIT HUP INT QUIT ILL ABRT FPE KILL SEGV PIPE ALRM TERM BUS | ||
sudo udevadm control --reload | ||
sudo udevadm trigger --subsystem-match=block | ||
|
||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
installer_conf=/tmp/ubuntu_desktop_installer.conf | ||
|
||
if ! source $installer_conf 2>/dev/null || [ -z "$AutoLoginUser" ]; then | ||
exit | ||
fi | ||
|
||
USER=$AutoLoginUser | ||
ROOT=/target | ||
chroot=chroot | ||
BACKUP= | ||
|
||
# Adapted from https://git.launchpad.net/ubiquity/tree/d-i/source/user-setup/user-setup-apply | ||
|
||
if [ -d "$ROOT/etc/gdm3" ]; then | ||
# Configure GDM autologin | ||
GDMCustomFile=$ROOT/etc/gdm3/custom.conf | ||
if [ -e "$GDMCustomFile" ] && [ "$BACKUP" ]; then | ||
cp "$GDMCustomFile" "${GDMCustomFile}$BACKUP" | ||
fi | ||
AutologinParameters="AutomaticLoginEnable=true\n\ | ||
AutomaticLogin=$USER\n" | ||
|
||
# Prevent from updating if parameters already present (persistent usb key) | ||
if ! `grep -qs "AutomaticLogin=$USER" $GDMCustomFile` ; then | ||
if [ -e "$GDMCustomFile" ]; then | ||
sed -i '/\(Automatic\)Login/d' $GDMCustomFile | ||
fi | ||
if ! `grep -qs '\[daemon\]' $GDMCustomFile` ; then | ||
echo '[daemon]' >> $GDMCustomFile | ||
fi | ||
sed -i "s/\[daemon\]/\[daemon\]\n$AutologinParameters/" $GDMCustomFile | ||
fi | ||
fi | ||
|
||
if $chroot $ROOT [ -f /etc/kde4/kdm/kdmrc ]; then | ||
# Configure KDM autologin | ||
$chroot $ROOT sed -i$BACKUP -r \ | ||
-e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \ | ||
-e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=$USER/" \ | ||
-e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \ | ||
/etc/kde4/kdm/kdmrc | ||
fi | ||
|
||
if $chroot $ROOT [ -f /etc/lxdm/lxdm.conf ]; then | ||
# Configure LXDM autologin with LXDE session | ||
$chroot $ROOT sed -i$BACKUP -r \ | ||
-e "s/^# autologin=dgod/autologin=$USER/" \ | ||
-e "s/^# session/session/" \ | ||
/etc/lxdm/lxdm.conf | ||
fi | ||
|
||
if $chroot $ROOT [ -f /etc/xdg/lubuntu/lxdm/lxdm.conf ]; then | ||
# Configure LXDM autologin with Lubuntu session | ||
$chroot $ROOT sed -i$BACKUP -r \ | ||
-e "s/^# autologin=dgod/autologin=$USER/" \ | ||
-e "s/^# session/session/" \ | ||
-e "s/startlxde/startlubuntu/" \ | ||
/etc/xdg/lubuntu/lxdm/lxdm.conf | ||
fi | ||
|
||
if $chroot $ROOT [ -f /usr/bin/sddm ]; then | ||
# Configure SDDM autologin with an appropiate session | ||
$chroot $ROOT /bin/sh -c "cat > /etc/sddm.conf" << EOF | ||
[Autologin] | ||
User=$USER | ||
Session=PLACEHOLDER | ||
EOF | ||
if $chroot $ROOT [ -f /usr/share/xsessions/plasma.desktop ]; then | ||
sed -i 's/PLACEHOLDER/plasma.desktop/' $ROOT/etc/sddm.conf | ||
elif $chroot $ROOT [ -f /usr/share/xsessions/Lubuntu.desktop ]; then | ||
sed -i 's/PLACEHOLDER/Lubuntu.desktop/' $ROOT/etc/sddm.conf | ||
elif $chroot $ROOT [ -f /usr/share/xsessions/lxqt.desktop ]; then | ||
sed -i 's/PLACEHOLDER/lxqt.desktop/' $ROOT/etc/sddm.conf | ||
else #fallback if some other DE/WM is used | ||
SDDMSESSION=$(ls /usr/share/xsessions | head -1) | ||
sed -i "s/PLACEHOLDER/$SDDMSESSION/" $ROOT/etc/sddm.conf | ||
fi | ||
fi | ||
if $chroot $ROOT [ -d /etc/lightdm ]; then | ||
# Configure LightDM autologin | ||
LightDMCustomFile=$ROOT/etc/lightdm/lightdm.conf | ||
AutologinParameters="autologin-guest=false\n\ | ||
autologin-user=$USER\n\ | ||
autologin-user-timeout=0" | ||
if ! grep -qs '^autologin-user' $LightDMCustomFile; then | ||
if ! grep -qs '^\[Seat:\*\]' $LightDMCustomFile; then | ||
echo '[Seat:*]' >> $LightDMCustomFile | ||
fi | ||
sed -i "s/\[Seat:\*\]/\[Seat:\*\]\n$AutologinParameters/" $LightDMCustomFile | ||
#oem config scenario | ||
else | ||
sed -i "s/^\(\(str *\)\?autologin-user\)=.*$/\1=$USER/g;" $ROOT/etc/lightdm/lightdm.conf | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
target=/target | ||
source_bluetooth=/var/lib/bluetooth | ||
target_bluetooth=$target/$source_bluetooth | ||
|
||
if [ -d $source_bluetooth ]; then | ||
rm -rf $target_bluetooth | ||
cp -a $source_bluetooth $target_bluetooth | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
target=/target | ||
source_nm=/etc/NetworkManager/system-connections | ||
target_nm=$target/$source_nm | ||
|
||
if [ -d $source_nm ] && [ -d $target_nm ]; then | ||
cp -anr $source_nm/. $target_nm | ||
fi | ||
|
||
source_netplan=/etc/netplan | ||
target_netplan=$target/$source_netplan | ||
|
||
if [ -d $source_netplan ] && [ -d $target_netplan ]; then | ||
cp -anr $source_netplan/90-NM-* $target_netplan | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
set -e | ||
# Currently curtin doesn't call flash-kernel after installing kernel | ||
# and generating initrd, but we need it on arm64 | ||
# and we need to update-grub after flash-kernel installed dtb | ||
if [ -e /target/usr/sbin/flash-kernel ]; then | ||
FK_FORCE=yes $SNAP/bin/subiquity/bin/subiquity-cmd curtin in-target -t /target -- flash-kernel | ||
fi | ||
if [ -e /target/usr/sbin/update-grub ]; then | ||
$SNAP/bin/subiquity/bin/subiquity-cmd curtin in-target -t /target -- update-grub | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
user=ubuntu | ||
target=/target | ||
source_schemas=/usr/share/glib-2.0/schemas | ||
target_schemas=$target/$source_schemas | ||
|
||
if [ ! -d $source_schemas ] || [ ! -d $target_schemas ] || ! id $user >/dev/null 2>&1; then | ||
exit | ||
fi | ||
|
||
dconf_dump() { | ||
target_schema=$target_schemas/20_ubuntu-desktop-installer-$1.gschema.override | ||
sudo -u $user dconf dump /org/gnome/desktop/$1/ > $target_schema | ||
# - [foo] -> [org.gnome.desktop.$1.foo:ubuntu] | ||
sed -i -E "s/^\[([^/]*)\]/\[org.gnome.desktop.$1.\1:ubuntu\]/g" $target_schema | ||
# - [/] -> [org.gnome.desktop.$1:ubuntu] | ||
sed -i -E "s/^\[\/\]$/\[org.gnome.desktop.$1:ubuntu\]/g" $target_schema | ||
[ -s $target_schema ] || rm $target_schema | ||
} | ||
|
||
dconf_dump a11y | ||
dconf_dump interface | ||
dconf_dump peripherals | ||
dconf_dump wm | ||
|
||
glib-compile-schemas $target_schemas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Provide a workaround so that ubuntu-desktop-installer does not | ||
# recreate LP: #1993318 | ||
|
||
TARGET=/target | ||
|
||
for pool in $(zpool list -H | cut -f1); do | ||
zpool set cachefile= "${pool}" | ||
if [ ! -d "/etc/zfs/zfs-list.cache" ] ; then | ||
mkdir -p "/etc/zfs/zfs-list.cache" | ||
fi | ||
if [ ! -d "${TARGET}/etc/zfs/zfs-list.cache" ] ; then | ||
mkdir -p "${TARGET}/etc/zfs/zfs-list.cache" | ||
fi | ||
# Force cache generation | ||
: >"/etc/zfs/zfs-list.cache/${pool}" | ||
# Execute zfs-list-cacher with a manual fake event | ||
env -i \ | ||
ZEVENT_POOL=${pool} \ | ||
ZED_ZEDLET_DIR=/etc/zfs/zed.d \ | ||
ZEVENT_SUBCLASS=history_event \ | ||
ZFS=zfs \ | ||
ZEVENT_HISTORY_INTERNAL_NAME=create \ | ||
/etc/zfs/zed.d/history_event-zfs-list-cacher.sh | ||
# ZFS list doesn't honor target prefix for chroots for | ||
# the mountpoint property | ||
# https://github.com/openzfs/zfs/issues/1078 | ||
# Drop leading /target from all mountpoint fields | ||
sed -E "s|\t${TARGET}/?|\t/|g" "/etc/zfs/zfs-list.cache/${pool}" \ | ||
> "${TARGET}/etc/zfs/zfs-list.cache/${pool}" | ||
# Ensure installer system doesn't generate mount units | ||
rm -f "/etc/zfs/zfs-list.cache/${pool}" | ||
done | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
telemetry=/var/log/installer/telemetry | ||
|
||
if [ ! -f $telemetry ]; then | ||
exit | ||
fi | ||
|
||
current_time=$(date +%s) | ||
created_at=$(stat --format %W $telemetry) | ||
duration=$(($current_time - $created_at)) | ||
|
||
# { | ||
# ... | ||
# "Stages": { | ||
# "0": "welcome", | ||
# ... | ||
# "1234": "done" // <== | ||
# } | ||
# } | ||
|
||
jq ".Stages.\"$duration\"=\"done\"" $telemetry > $telemetry.tmp | ||
mv $telemetry.tmp $telemetry |
Oops, something went wrong.