]> gitweb.fluxo.info Git - trashman.git/commitdiff
Rename __trashman_ functions to trashman_
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 17 Nov 2017 13:35:59 +0000 (11:35 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 17 Nov 2017 13:35:59 +0000 (11:35 -0200)
13 files changed:
share/trashman/composer/unix/install
share/trashman/composer/unix/test
share/trashman/docker/unix/linux/debian/check
share/trashman/docker/unix/linux/debian/install
share/trashman/docker/unix/linux/debian/test
share/trashman/nodejs/unix/linux/debian/check
share/trashman/nodejs/unix/linux/debian/install
share/trashman/nodejs/unix/linux/debian/test
share/trashman/trashman/debian
share/trashman/trashman/functions
share/trashman/trashman/unix/install
share/trashman/trashman/unix/test
trashman

index 81d8b9086a6292b00c1cc8a2c80b5fb239e6c250..e368e0a8b377e2cf9549440d7cbc83229865fd48 100755 (executable)
@@ -13,7 +13,7 @@ SHARE="$1"
 . $SHARE/trashman/functions || exit 1
 
 # Requirements
-__trashman_require php wget
+trashman_require php wget
 
 # Download
 #php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
index f84ae60826024a7fca5c69892b4c58e2ca75ff62..85c87cb137d011a27e908b5b2bd9f5956cc0cd1a 100755 (executable)
@@ -15,7 +15,7 @@ if ! which composer > /dev/null 2>&1; then
 fi
 
 # Run hello-world test program
-__trashman_echo_keepline "Testing program output... "
+trashman_echo_keepline "Testing program output... "
 composer -V
 status="$?"
 
index 60574a74838c6c957e9a8eb0ce5c56e8a1114c04..9ca9d78f406ceb7ddb81faefcc844ca24da56055 100755 (executable)
@@ -12,13 +12,13 @@ SHARE="$1"
 
 if [ -e "/etc/apt/trusted.gpg.d/docker.gpg" ]   && \
    [ -e "/etc/apt/sources.list.d/docker.list" ] && \
-   __trashman_apt_check docker-ce; then
+   trashman_apt_check docker-ce; then
   exit 0
 fi
 
 if [ ! -e "/etc/apt/trusted.gpg.d/docker.gpg" ]   && \
    [ ! -e "/etc/apt/sources.list.d/docker.list" ] && \
-   ! __trashman_apt_check docker-ce; then
+   ! trashman_apt_check docker-ce; then
   exit 1
 fi
 
index 155802067af41e6c8103dd15b686e4c6284b61bf..b80caba7f84a41fdf6ef1d2dd94f9dd1e9563b1f 100755 (executable)
@@ -10,22 +10,22 @@ SHARE="$1"
 . $SHARE/trashman/functions || exit 1
 . $SHARE/trashman/debian    || exit 1
 
-DISTRO="`__trashman_distro`"
-ARCH="`__trashman_debian_arch`"
-RELEASE="`__trashman_distro_release`"
+DISTRO="`trashman_distro`"
+ARCH="`trashman_debian_arch`"
+RELEASE="`trashman_distro_release`"
 
 # Install requirements
-apt-get update && __trashman_apt_install apt-transport-https
+apt-get update && trashman_apt_install apt-transport-https
 
 # Install pubkey
-__trashman_install_apt_key $SHARE/docker/unix/linux/debian/pubkey.gpg docker.gpg
+trashman_install_apt_key $SHARE/docker/unix/linux/debian/pubkey.gpg docker.gpg
 
 # Create sources.list entry
 echo "deb [arch=$ARCH] https://download.docker.com/linux/$DISTRO $RELEASE stable" > /etc/apt/sources.list.d/docker.list
 
 # Update and install
-apt-get update && __trashman_apt_install docker-ce || exit 1
+apt-get update && trashman_apt_install docker-ce || exit 1
 
 # Additional info
-__trashman_echo "Docker sucessfully installed."
-__trashman_echo "You might want to add your regular user into the 'docker' group"
+trashman_echo "Docker sucessfully installed."
+trashman_echo "You might want to add your regular user into the 'docker' group"
index 69611baf4d3adff1e3c23685cffa383d1d1d3d77..35dc6260e83744b9e88ab2a621c3d74f8f9603fc 100755 (executable)
@@ -15,7 +15,7 @@ if ! which docker > /dev/null 2>&1; then
 fi
 
 # Run hello-world test program
-__trashman_echo "Running docker helll-world image..."
+trashman_echo "Running docker helll-world image..."
 docker run hello-world
 status="$?"
 
index b32f3d4bce2e25e4fa32bb439d01513b6a56c6cf..045674fb1125c549943414051c3802955e5c24e6 100755 (executable)
@@ -12,13 +12,13 @@ SHARE="$1"
 
 if [ -e "/etc/apt/trusted.gpg.d/nodesource.gpg" ]   && \
    [ -e "/etc/apt/sources.list.d/nodesource.list" ] && \
-   __trashman_apt_check nodejs; then
+   trashman_apt_check nodejs; then
   exit 0
 fi
 
 if [ ! -e "/etc/apt/trusted.gpg.d/nodesource.gpg" ]   && \
    [ ! -e "/etc/apt/sources.list.d/nodesource.list" ] && \
-   ! __trashman_apt_check nodejs; then
+   ! trashman_apt_check nodejs; then
   exit 1
 fi
 
index 7fad275508c60f510b1006d1d431d50fce46b0af..b5dad0a926bb50ab864fbbcb1f66046b19339cec 100755 (executable)
@@ -25,7 +25,7 @@ SHARE="$1"
 . $SHARE/trashman/debian    || exit 1
 
 # Install pubkey
-__trashman_install_apt_key $SHARE/nodejs/unix/linux/debian/pubkey.gpg nodesource.gpg
+trashman_install_apt_key $SHARE/nodejs/unix/linux/debian/pubkey.gpg nodesource.gpg
 
 #
 # End custom trashman code block
@@ -356,7 +356,7 @@ setup
 # Begin custom trashman code block
 #
 
-__trashman_apt_install nodejs
+trashman_apt_install nodejs
 
 #
 # End custom trashman code block
index 6af295bcaadc388185e87a6107362a157d774f79..8e6eb9cb0e52b6b6bff8e9f5f04e9cda104ba64c 100755 (executable)
@@ -15,7 +15,7 @@ if ! which nodejs > /dev/null 2>&1; then
 fi
 
 # Run hello-world test program
-__trashman_echo_keepline "Testing program version... "
+trashman_echo_keepline "Testing program version... "
 nodejs -v
 status="$?"
 
index 395512b70c9d314325264bca789c98d6c4bf7707..abf26126e327cbecc0f67e9884e9b3981be0c41a 100644 (file)
@@ -3,7 +3,7 @@
 # Custom functions for debian-like systems.
 #
 
-__trashman_apt_install() {
+trashman_apt_install() {
   if [ -z "$1" ]; then
     return
   fi
@@ -12,7 +12,7 @@ __trashman_apt_install() {
 }
 
 # Machine architecture
-__trashman_debian_arch() {
+trashman_debian_arch() {
   local arch="`uname -m`"
 
   # Fix arch
@@ -24,7 +24,7 @@ __trashman_debian_arch() {
 }
 
 # Check if package is installed
-__trashman_apt_check() {
+trashman_apt_check() {
   if [ -z "$1" ]; then
     return
   fi
@@ -36,23 +36,23 @@ __trashman_apt_check() {
 }
 
 # Install a package
-__trashman_apt_install_packages() {
+trashman_apt_install_packages() {
   if [ -z "$1" ]; then
     return
   fi
 
   for package in $*; do
-    __trashman_apt_check $package
+    trashman_apt_check $package
 
     if [ "$?" = "1" ]; then
-      __trashman_echo "Installing package $package..."
+      trashman_echo "Installing package $package..."
       DEBIAN_FRONTEND=noninteractive apt-get install $package -y || exit 1
     fi
   done
 }
 
 # Install an apt repository key
-__trashman_install_apt_key() {
+trashman_install_apt_key() {
   local orig="$1"
   local dest="$2"
 
index 133552806eb854a653840f83a988bd6ba38fc666..7478322285117cf85fb2e50c11c78e4037055007 100644 (file)
@@ -8,30 +8,30 @@ GIT="/usr/bin/git"
 DIRNAME="$SHARE/../.."
 
 # Message
-__trashman_echo() {
+trashman_echo() {
   #echo ""
   echo "-> $*"
 }
 
 # Message, no newline
-__trashman_echo_keepline() {
+trashman_echo_keepline() {
   #echo ""
   echo -n "-> $*"
 }
 
 # Our most common ancestor
-__trashman_ancestor() {
+trashman_ancestor() {
   echo "unix"
 }
 
 # Determine OS family
-__trashman_family() {
+trashman_family() {
   uname | tr '[:upper:]' '[:lower:]'
 }
 
 # Determine distro name
-__trashman_distro() {
-  local uname="`__trashman_family`"
+trashman_distro() {
+  local uname="`trashman_family`"
 
   if [ "$uname" = "linux" ]; then
     if [ -e "/etc/debian_version" ]; then
@@ -43,38 +43,38 @@ __trashman_distro() {
 }
 
 # Distro release version
-__trashman_distro_release() {
+trashman_distro_release() {
   if [ -e "/etc/os-release" ]; then
     grep "^VERSION=" /etc/os-release | cut -d '(' -f 2 | cut -d ')' -f 1
   fi
 }
 
 # Machine architecture
-__trashman_arch() {
+trashman_arch() {
   uname -m
 }
 
 # Require a program available on $PATH
-__trashman_require() {
+trashman_require() {
   if [ -z "$1" ]; then
     return
   fi
 
   for program in $*; do
     if ! which $program > /dev/null 2>&1; then
-      __trashman_echo "Requirement absent: $program"
+      trashman_echo "Requirement absent: $program"
       exit 1
     fi
   done
 }
 
 # Return the folder where actions are available for a package
-__trashman_actions_folder() {
+trashman_actions_folder() {
   local package="$1"
   local actions=""
-  local ancestor="`__trashman_ancestor`"
-  local family="`__trashman_family`"
-  local distro="`__trashman_distro`"
+  local ancestor="`trashman_ancestor`"
+  local family="`trashman_family`"
+  local distro="`trashman_distro`"
   local findopts="-maxdepth 1 -type f -executable -exec basename {}"
 
   if [ -z "$package" ]; then
@@ -113,7 +113,7 @@ __trashman_actions_folder() {
 }
 
 # Return the list of available actions from a package
-__trashman_actions() {
+trashman_actions() {
   local package="$1"
   local findopts="-maxdepth 1 -type f -executable -exec basename {}"
 
@@ -121,7 +121,7 @@ __trashman_actions() {
     return
   fi
 
-  local folder="`__trashman_actions_folder $package`"
+  local folder="`trashman_actions_folder $package`"
 
   if [ ! -z "$SHARE/$package/$folder" ]; then
     find $SHARE/$package/$folder $findopts \; | xargs
@@ -129,12 +129,12 @@ __trashman_actions() {
 }
 
 # Return list of implementations
-__trashman_implementations() {
+trashman_implementations() {
   local actions=""
   local implementations=""
 
   for package in `ls $SHARE`; do
-    actions="`__trashman_actions $package`"
+    actions="`trashman_actions $package`"
 
     if [ ! -z "$actions" ]; then
       implementations="$implementations $package"
@@ -145,7 +145,7 @@ __trashman_implementations() {
 }
 
 # Version information
-__trashman_version() {
+trashman_version() {
   echo "master branch:"
   echo "=============="
   echo ""
@@ -159,12 +159,12 @@ __trashman_version() {
 }
 
 # Fetch
-__trashman_fetch() {
+trashman_fetch() {
   ( cd $DIRNAME && $GIT fetch --all && $GIT log --show-signature -n 1 --remotes --branches=origin/master )
 }
 
 # Merge
-__trashman_merge() {
+trashman_merge() {
   (
   cd $DIRNAME && $GIT merge origin/master                 && \
                  $GIT submodule sync          --recursive && \
@@ -173,7 +173,7 @@ __trashman_merge() {
 }
 
 
-__trashman_check_exit_status() {
+trashman_check_exit_status() {
   local action="$1"
   local status="$2"
 
@@ -183,25 +183,25 @@ __trashman_check_exit_status() {
 
   if [ "$action" = "check" ]; then
     if [ "$status" = "0" ]; then
-      __trashman_echo "Package $package is installed system-wide"
+      trashman_echo "Package $package is installed system-wide"
     elif [ "$status" = "1" ]; then
-      __trashman_echo "Package $package is not installed system-wide"
+      trashman_echo "Package $package is not installed system-wide"
     elif [ "$status" = "2" ]; then
-      __trashman_echo "Package $package is partially installed system-wide"
+      trashman_echo "Package $package is partially installed system-wide"
     fi
   fi
 
   if [ "$action" = "test" ]; then
     if [ "$status" = "0" ]; then
-      __trashman_echo "Package $package is running as expected"
+      trashman_echo "Package $package is running as expected"
     elif [ "$status" = "1" ]; then
-      __trashman_echo "Package $package is not running as expected"
+      trashman_echo "Package $package is not running as expected"
     fi
   fi
 }
 
 # Check for superuser privileges
-__trashman_check_root() {
+trashman_check_root() {
   local action="$1"
 
   if [ -z "$action" ]; then
@@ -213,7 +213,7 @@ __trashman_check_root() {
   fi
 
   if [ "`whoami`" != "root" ]; then
-    __trashman_echo "Action $action requires root privileges"
+    trashman_echo "Action $action requires root privileges"
     exit 1
   fi
 }
index db2206c0b5962d63e2a6d697803bd38bfb608bf8..2d504a0192c18f12e0fc5a2ee58541a9ec45122f 100755 (executable)
@@ -13,7 +13,7 @@ FOLDER="/usr/local"
 
 # Check for rsync
 if ! which rsync > /dev/null 2>&1; then
-  __trashman_echo "Needs rsync to install trashman"
+  trashman_echo "Needs rsync to install trashman"
   exit 1
 fi
 
index 98cb368fff0d6a04ecbbb00c64ec933b5129149a..7397fff411ab287ed298e0ffd4c1e79a5ae09af6 100755 (executable)
@@ -13,9 +13,9 @@ FOLDER="/usr/local"
 
 # Run test suite
 if trashman | grep -q "^trashman:"; then
-  __trashman_echo "trashman seems to be working"
+  trashman_echo "trashman seems to be working"
   exit 0
 else
-  __trashman_echo "trashman not working correctly"
+  trashman_echo "trashman not working correctly"
   exit 1
 fi
index 539e15d47eb6dae9a6b9a8dd9075c4336410625b..34a1247d97a0eb5fc4505936f158da49f986f234 100755 (executable)
--- a/trashman
+++ b/trashman
@@ -37,7 +37,7 @@ fi
 . $SHARE/trashman/functions || exit 1
 
 # Display usage
-__trashman_usage() {
+trashman_usage() {
   echo "$BASENAME: package ports tree and heterodox configuration provisioner"
   echo ""
   echo "usage: $BASENAME <fetch|merge>"
@@ -46,9 +46,9 @@ __trashman_usage() {
   echo "available packages:"
   echo ""
 
-  for package in `__trashman_implementations`; do
+  for package in `trashman_implementations`; do
     if [ -e "$SHARE/$package/info" ]; then
-      echo "\t $package: `cat $SHARE/$package/info` (`__trashman_actions $package | sed -e 's/ /|/g'`)"
+      echo "\t $package: `cat $SHARE/$package/info` (`trashman_actions $package | sed -e 's/ /|/g'`)"
     fi
   done
 
@@ -58,13 +58,13 @@ __trashman_usage() {
 
 # Dispatch
 if [ -z "$ACTION" ]; then
-  __trashman_usage
+  trashman_usage
 elif [ "$ACTION" = "fetch" ]; then
-  __trashman_$ACTION
+  trashman_$ACTION
 elif [ "$ACTION" = "merge" ]; then
-  __trashman_$ACTION
+  trashman_$ACTION
 elif [ "$ACTION" = "version" ]; then
-  __trashman_$ACTION
+  trashman_$ACTION
 else
   # Get packages param
   shift
@@ -72,28 +72,28 @@ else
 
   # Setup packages
   if [ -z "$PACKAGES" ]; then
-    __trashman_usage
+    trashman_usage
   else
     for package in $PACKAGES; do
-      if [ ! -z "`__trashman_actions $package`" ]; then
-        folder="`__trashman_actions_folder $package`"
+      if [ ! -z "`trashman_actions $package`" ]; then
+        folder="`trashman_actions_folder $package`"
 
         # Checking for privileges
-        __trashman_check_root $ACTION
+        trashman_check_root $ACTION
 
         if [ -x "$SHARE/$package/$folder/$ACTION" ]; then
           if [ "$ACTION" != "check" ] && [ "$ACTION" != "test" ]; then
-            __trashman_echo "Issuing action $ACTION for $package ($folder)..."
+            trashman_echo "Issuing action $ACTION for $package ($folder)..."
           fi
 
           # Run action for package
           $SHARE/$package/$folder/$ACTION $SHARE
-          __trashman_check_exit_status $ACTION $?
+          trashman_check_exit_status $ACTION $?
         else
-          __trashman_echo "No such action $ACTION for package $package, skipping"
+          trashman_echo "No such action $ACTION for package $package, skipping"
         fi
       else
-        __trashman_echo "No such package $package, skipping"
+        trashman_echo "No such package $package, skipping"
       fi
     done