[Lunar-commits] r17189 - in lunar/trunk: sbin var/lib/lunar/functions var/lib/lunar/menu

Auke Kok sofar at lunar-linux.org
Sun Nov 6 06:58:26 UTC 2005


Author: sofar
Date: 2005-11-06 06:58:18 +0000 (Sun, 06 Nov 2005)
New Revision: 17189

Added:
   lunar/trunk/var/lib/lunar/menu/license.menu
Modified:
   lunar/trunk/sbin/lunar
   lunar/trunk/var/lib/lunar/functions/modules.lunar
Log:
More license code: add lunar menus and some default handling code. see ML for additional info.


Modified: lunar/trunk/sbin/lunar
===================================================================
--- lunar/trunk/sbin/lunar	2005-11-06 06:15:26 UTC (rev 17188)
+++ lunar/trunk/sbin/lunar	2005-11-06 06:58:18 UTC (rev 17189)
@@ -634,6 +634,8 @@
     I_HELP="Select the test that lunar fix, and AUTOFIX execute"
     D_HELP="Options for downloads"
     L_HELP="Select default lunar module"
+    A_HELP="Select accepted licenses"
+    R_HELP="Select rejected licenses"
 
     COMMAND=`$DIALOG  --title "Option Menu"                    \
                       --item-help                              \
@@ -649,7 +651,9 @@
                       "F"  "Feature Menu"           "$F_HELP"  \
                       "I"  "Integrity Checking"     "$I_HELP"  \
                       "M"  "Software Mirrors"       "$M_HELP"  \
-                      "O"  "Optimize Architecture"  "$O_HELP"`
+                      "O"  "Optimize Architecture"  "$O_HELP"  \
+		      "A"  "Accepted licenses"      "$A_HELP"  \
+		      "R"  "Rejected licenses"      "$R_HELP"`
 
   do
     case  $COMMAND in
@@ -661,6 +665,8 @@
       M)  mirror_menu            ;;
       O)  . /var/lib/lunar/menu/optimize.menu && optimize_menu          ;;
       L)  set_default_module     ;;
+      A)  set_accepted_licenses  ;;
+      R)  set_rejected_licenses  ;;
     esac
   done
 }

Modified: lunar/trunk/var/lib/lunar/functions/modules.lunar
===================================================================
--- lunar/trunk/var/lib/lunar/functions/modules.lunar	2005-11-06 06:15:26 UTC (rev 17188)
+++ lunar/trunk/var/lib/lunar/functions/modules.lunar	2005-11-06 06:58:18 UTC (rev 17189)
@@ -285,15 +285,43 @@
 
 
 module_license_accepted() {
+  #
+  # This code handles acceptance or rejection of certain licenses.
+  #
+  # valid licenses currently are:
+  # osi == gpl gpl2 lgpl gfdl bsd mpl cc apache artistic qpl
+  
   debug_msg "module_license_accepted ($@)"
-  local L LICENSE
+
+  local L LICENSE IS_OSI
   LICENSE=$(run_details $1 > /dev/null ; echo $LICENSE)
+  # assume it's osi if it's empty
+  if [ -z "$LICENSE" ]; then
+    debug_msg "assuming LICENSE=\"osi\""
+    LICENSE="osi"
+  fi
+  
+  # check for osi license
+  case LICENSE in
+    gpl|gpl2|lgpl|gfdl|bsd|mpl|cc|apache|artistic|qpl)
+      IS_OSI=yes
+    ;;
+  esac
+
+  # default case: only accept osi licenses:
+  if [ -z "${ACCEPTED_LICENSES}${REJECTED_LICESES}" ]; then
+    verbose_msg "Assuming we only accept osi licenses, please adjust your license acceptance settings in the lunar menus".
+    ACCEPTED_LICENSES=osi
+  fi
+  
   # check if $MODULE's $LICENSE is accepted or not, works as follows:
   # if ACCEPTED_LICENSES is set, LICENSE *must* be listed, else if
   # REJECTED_LICESES is set, must _NOT_ be listed
+  # * accept "osi" will accept all osi licenses
+  # * accept "all" will accept anything
   if [ -n "$(echo $ACCEPTED_LICENSES)" ]; then
     for L in $ACCEPTED_LICENSES; do
-      if [ "$LICENSE" == "$L" ]; then
+      if [ "$L" == "osi" -a "$IS_OSI" == "yes" ] || [ "$L" == "all" ] || [ "$LICENSE" == "$L" ] ; then
         # explicitly accepted license!
 	debug_msg "module_license_accepted: \"$LICENSE\" is explicitly accepted"
         return 0

Added: lunar/trunk/var/lib/lunar/menu/license.menu
===================================================================
--- lunar/trunk/var/lib/lunar/menu/license.menu	2005-11-06 06:15:26 UTC (rev 17188)
+++ lunar/trunk/var/lib/lunar/menu/license.menu	2005-11-06 06:58:18 UTC (rev 17189)
@@ -0,0 +1,71 @@
+############################################################
+#                                                          #
+# This code is written for Lunar Linux, see                #
+# http://lunar-linux.org                                   #
+#                                                          #
+############################################################
+#                                                          #
+# $MENUS/license                                           #
+# includes menu for setting the accepted/rejected licenses #
+#                                                          #
+# 20051105                                                 #
+#                                                          #
+############################################################
+#                                                          #
+# Copyrighted Auke Kok 2005 under GPLv2                    #
+#                                                          #
+############################################################
+
+set_accepted_licenses()
+{
+
+    PROMPT="Please select acceptable licenses
+
+Lunar by default only accepts osi-approved licenses. You will
+need to tell lunar to explicitly accept or reject licenses if
+you wish to change this behaviour.
+
+You have several ways of doing so:
+ o Enter \"all\" in this field to except every license.
+ o Enter \"osi\" to accept any known osi approved license.
+ o Or enter any specific license name in here to accept it.
+ o Enter licenses in the REJECTED_LICENSES and leave this
+   field empty to reject only those licenses.
+  
+Currently known osi licenses: gpl gpl2 lgpl gfdl bsd mpl cc apache
+artistic qpl."
+
+    ACCEPTED_LICENSES=`$DIALOG --title "Select accepted licenses" \
+        --ok-label "Commit" --inputbox                            \
+	"$PROMPT" 0 0 "$ACCEPTED_LICENSES"`
+
+    set_local_config ACCEPTED_LICENSES "$ACCEPTED_LICENSES"
+
+}
+
+set_rejected_licenses()
+{
+
+    PROMPT="Please select rejected licenses
+
+Lunar by default only accepts osi-approved licenses. You will
+need to tell lunar to explicitly accept or reject licenses if
+you wish to change this behaviour.
+
+You have several ways of doing so:
+ o use the ACCEPTED_LICENSES field to accept only specific licenses
+ o enter any license name in here to reject it - however \"osi\"
+   or \"all\" does not work in this field - you must use the exact
+   name.
+
+Remember that if you leave ACCEPTED_LICENSES empty, all licenses will
+be accepted that do not match the REJECTED_LICENSES list."
+
+    REJECTED_LICENSES=`$DIALOG --title "Select rejected licenses" \
+        --ok-label "Commit" --inputbox                            \
+	"$PROMPT" 0 0 "$REJECTED_LICENSES"`
+
+    set_local_config REJECTED_LICENSES "$REJECTED_LICENSES"
+
+}
+



More information about the Lunar-commits mailing list