Skip to content

Commit ff5fe89

Browse files
author
Bernhard Landauer
authored
Merge pull request #4 from Shells-com/master
merge upstream
2 parents f5cd483 + 5fc8c1a commit ff5fe89

File tree

4 files changed

+99
-0
lines changed

4 files changed

+99
-0
lines changed

build_image.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ set -e
1010
. oscfg/manjaro.sh
1111
. oscfg/gentoo.sh
1212
. oscfg/fedora.sh
13+
. oscfg/opensuse.sh
1314

1415
dodistro() {
1516
if [ -f "$1-$DATE.qcow2" ]; then
@@ -32,6 +33,9 @@ dodistro() {
3233
fedora-*)
3334
fedora_distro "$1"
3435
;;
36+
opensuse-*)
37+
opensuse_distro "$1"
38+
;;
3539
*)
3640
echo "unsupported distro $1"
3741
;;

oscfg/debian.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ debian_cfg() {
7575
case "$1" in
7676
debian-*-desktop)
7777
DEBIAN_FRONTEND=noninteractive run apt-get install -y gnome-software guake dconf-cli
78+
DEBIAN_FRONTEND=noninteractive run apt-get install -y flatpak gnome-software-plugin-flatpak
79+
run flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
80+
run appstreamcli refresh --force
7881
run systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
7982
;;
8083
esac

oscfg/opensuse.sh

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/bin/sh
2+
3+
DLURL=https://download.opensuse.org
4+
TWREPO=/tumbleweed/repo/oss
5+
TWUPDATEREPO=/update/tumbleweed
6+
LEAPREPO=/distribution/openSUSE-stable/repo/oss
7+
LEAPUPDATEREPO=/update/openSUSE-stable
8+
9+
opensuse_distro() {
10+
# install distro using zypper into "$WORK"
11+
# $1 can be something like opensuse-tumbleweed-gnome or opensuse-leap-xfce
12+
# DISTRO is split out from $1, the 2nd 'parameter', i.e. tumbleweed or leap
13+
DISTRO=$(echo "$1" | cut -f2 -d-)
14+
# PATTERN is split out from $1, the 3rd 'parameter', i.e. gnome, kde, xfce
15+
local PATTERN=$(echo "$1" | cut -f3 -d-)
16+
17+
case "$1" in
18+
*-base)
19+
create_empty
20+
ZYPPCMD="zypper -n --root $WORK"
21+
if [ "$DISTRO" == "tumbleweed" ]; then
22+
REPO=$TWREPO
23+
UPDATEREPO=$TWUPDATEREPO
24+
elif [ "$DISTRO" == "leap" ]; then
25+
REPO=$LEAPREPO
26+
UPDATEREPO=$LEAPUPDATEREPO
27+
else
28+
echo "Unsupported openSUSE distro ($DISTRO). Supported are tumbleweed and leap!"
29+
exit 1
30+
fi
31+
$ZYPPCMD ar -f $DLURL$REPO repo-oss
32+
$ZYPPCMD ar -f $DLURL$UPDATEREPO repo-oss-update
33+
$ZYPPCMD --gpg-auto-import-keys ref
34+
$ZYPPCMD install --download in-advance -t pattern enhanced_base x11
35+
$ZYPPCMD install --download in-advance NetworkManager spice-vdagent
36+
# we get a cloud-firstboot
37+
run systemctl mask systemd-firstboot
38+
# ensure networkmanager is enabled and not systemd-networkd
39+
run systemctl disable wicked
40+
run systemctl enable NetworkManager NetworkManager-wait-online
41+
run systemctl enable sshd
42+
# make sudo available without password (default for key auth)
43+
echo "%shellsuser ALL=(ALL) NOPASSWD: ALL" > "$WORK/etc/sudoers.d/01-shells" && chmod 440 "$WORK/etc/sudoers.d/01-shells"
44+
;;
45+
*)
46+
# start from base
47+
if [ ! -f "opensuse-$DISTRO-base.qcow2" ]; then
48+
dodistro "opensuse-$DISTRO-base"
49+
fi
50+
prepare opensuse-$DISTRO-base
51+
ZYPPCMD="zypper -n --root $WORK"
52+
$ZYPPCMD --gpg-auto-import-keys ref
53+
$ZYPPCMD dup
54+
$ZYPPCMD install --download in-advance -t pattern $PATTERN
55+
56+
opensuse_cfg "$DISTRO" "$PATTERN"
57+
;;
58+
esac
59+
}
60+
61+
opensuse_cfg() {
62+
local DISTRO=$1
63+
local DESKTOP=$2
64+
if [ "$DESKTOP" == "gnome" ]; then
65+
cat >>"$WORK/usr/share/glib-2.0/schemas/30-Shells.gschema.override" <<EOF
66+
# disable gnome screen blanking, logout & power management
67+
[org/gnome/desktop/screensaver]
68+
lock-enabled=false
69+
idle-activation-enabled=false
70+
71+
[org/gnome/desktop/lockdown]
72+
disable-lock-screen=true
73+
disable-log-out=true
74+
75+
[org/gnome/desktop/session]
76+
idle-delay=uint32 0
77+
EOF
78+
run /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
79+
elif [ "$DESKTOP" == "kde" ]; then
80+
true # nothing to be done yet
81+
fi
82+
83+
# add firstrun
84+
add_firstrun NetworkManager-wait-online.service
85+
do_linux_config
86+
}

scripts/firstrun.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ if [ x"$SHELLS_USERNAME" != x ]; then
134134
echo "User=$SHELLS_USERNAME" >>/etc/sddm.conf.d/autologin.conf
135135
echo "Session=plasma.desktop" >>/etc/sddm.conf.d/autologin.conf
136136
fi
137+
138+
# openSUSE configures gdm/sddm/lightdm centrally via /etc/sysconfig/displaymanager
139+
if [ -f /etc/sysconfig/displaymanager ]; then
140+
sed -i "s/^DISPLAYMANAGER_AUTOLOGIN=\".*\"/DISPLAYMANAGER_AUTOLOGIN=\"$SHELLS_USERNAME\"/" /etc/sysconfig/displaymanager
141+
test -f /etc/sddm.conf.d/autologin.conf && rm /etc/sddm.conf.d/autologin.conf
142+
fi
137143
else
138144
# no user creation, let's at least setup root
139145
if [ x"$SHELLS_SHADOW" != x ]; then

0 commit comments

Comments
 (0)