Subject: [alpine-devel] [PATCH] alpine-conf: merged setup-xfce|gparted-desktop into setup-desktop

From: Alan Lacerda <[email-masked]>
Date: Fri, 21 Nov 2014 18:05:40 +0000

---
 Makefile                 |   1 +
 setup-desktop.in         | 105 +++++++++++++++++++++++++++++++++++++++++++++++
 setup-gparted-desktop.in |  42 -------------------
 setup-xfce-desktop       |   6 ---
 4 files changed, 106 insertions(+), 48 deletions(-)
 create mode 100644 setup-desktop.in
 delete mode 100644 setup-gparted-desktop.in
 delete mode 100644 setup-xfce-desktop

diff --git a/Makefile b/Makefile
index 620d8ec..fa5c175 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,7 @@ SBIN_FILES	:= lbu\
 		setup-apkcache\
 		setup-apkrepos\
 		setup-bootable\
+		setup-desktop\
 		setup-disk\
 		setup-dns\
 		setup-gparted-desktop\
diff --git a/setup-desktop.in b/setup-desktop.in
new file mode 100644
index 0000000..5355ee4
--- /dev/null
+++ b/setup-desktop.in
@@ -0,0 +1,105 @@
+#!/bin/sh
+#
+# setup-desktop - utility to configure a desktop environment
+# Copyright (c) 2014 A L - Alpine Linux
+# May be distributed under GPL2
+#
+
+apk update -q
+
+drivers=$(apk search -q 'xf86-video-*' | grep -v -- '-doc$')
+
+common_pkgs="gst-plugins-good1 gst-plugins-bad1 \
+        gst-plugins-ugly1 gst-libav1 \
+        gst-plugins-good1 gst-plugins-bad1 \
+        gst-plugins-ugly1 gst-ffmpeg0.10 \
+        claws-mail claws-mail-plugins-pgp \
+        claws-mail-plugins-smime \
+        claws-mail-plugins-address-keeper \
+        claws-mail-plugins-pdf-viewer \
+        firefox icedtea-web pidgin \
+        faenza-icon-theme-pidgin pidgin-lang \
+        pidgin-otr galculator \
+        evince audacious sudo xinit setxkbmap \
+        xrandr abiword gnumeric lxdm ttf-freefont"
+
+xfce_pkgs="mousepad ristretto xfce4"
+
+gparted_pkgs="gparted st openbox"
+
+# Our default choice goes to...
+environment="xfce"
+
+setup_xfce () {
+        setup-xorg-base $drivers
+        apk add $common_pkgs $xfce_pkgs
+        rc-update add lxdm
+}
+
+setup_gparted () {
+        setup-xorg-base $gparted_pkgs
+
+# create openbox menu
+mkdir -p ~/.config/openbox
+cat >~/.config/openbox/menu.xml<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+
+<openbox_menu xmlns="http://openbox.org/3.4/menu">
+<menu id="root-menu" label="Openbox 3">
+  <separator label="Applications" />
+  <item label="GParted">
+    <action name="Execute">
+      <command>gparted</command>
+    </action>
+  </item>
+  <item label="aterm">
+    <action name="Execute">
+      <command>aterm</command>
+    </action>
+  </item>
+  <separator />
+  <item label="Log Out">
+    <action name="Exit">
+      <prompt>yes</prompt>
+    </action>
+  </item>
+</menu>
+</openbox_menu>
+EOF
+
+# create xinitrc
+cat >~/.xinitrc <<EOF
+gparted &
+exec openbox-session
+EOF
+
+echo ""
+echo " To start GParted run: startx"
+echo ""
+
+}
+
+usage() {
+        echo "Usage: $0 <option> [environment]"
+        echo ""
+        echo "option:"
+        echo -e "   --environment|-e \t Define the environment to install"
+        echo -e "   --help|-h \t\t Show this help message"
+        echo ""
+        echo "envitonment:"
+        echo -e "   xfce \t XFCE4 Desktop Environment"
+        echo -e "   gparted \t Basic Gparted Desktop Environment"
+        exit 1
+}
+
+case x"$1" in
+    x) setup_$environment
+    x-e|x--environment) environment="$2" ;;
+    *) usage ;;
+esac
+
+if [ "$environment" == "gparted" ] || [ "$environment" == "xfce" ]; then
+        setup_$environment
+else
+        usage
+fi
diff --git a/setup-gparted-desktop.in b/setup-gparted-desktop.in
deleted file mode 100644
index 37cefe6..0000000
--- a/setup-gparted-desktop.in
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-
-setup-xorg-base gparted xinit st openbox ttf-freefont $@
-
-# create openbox menu
-mkdir -p ~/.config/openbox
-cat >~/.config/openbox/menu.xml<<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-
-<openbox_menu xmlns="http://openbox.org/3.4/menu">
-<menu id="root-menu" label="Openbox 3">
-  <separator label="Applications" />
-  <item label="GParted">
-    <action name="Execute">
-      <command>gparted</command>
-    </action>
-  </item>
-  <item label="aterm">
-    <action name="Execute">
-      <command>aterm</command>
-    </action>
-  </item>
-  <separator />
-  <item label="Log Out">
-    <action name="Exit">
-      <prompt>yes</prompt>
-    </action>
-  </item>
-</menu>
-</openbox_menu>
-EOF
-
-# create xinitrc
-cat >~/.xinitrc <<EOF
-gparted &
-exec openbox-session
-EOF
-
-echo ""
-echo " To start GParted run: startx"
-echo ""
-
diff --git a/setup-xfce-desktop b/setup-xfce-desktop
deleted file mode 100644
index 2a2ce2d..0000000
--- a/setup-xfce-desktop
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-videodrivers=$(apk search --quiet --exact xf86-video* | grep -v -- '-doc$')
-
-setup-xorg-base $videodrivers xfce4 firefox slim
-
-- 
2.1.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---