mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	snap-packaging for gitea (#2568)
* Modify tbraeutigam/gogs-snap for gitea * Fix building on 16.04 (manually build go-bindata). -> add _source.tar.bz2 to .gitignore (used by snapcraft cleanbuild) * Streamline Snap packaging: - Take advantage of install-hooks (snapd 2.27) - Use snapctl configuration storage for unchanging values * Move to using Snap Hooks for configuration * Missed re-adding daemon statement * Fix two warnings from Codacy.
This commit is contained in:
		
							
								
								
									
										3
									
								
								snap/hooks/configure
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								snap/hooks/configure
									
									
									
									
										vendored
									
									
										Executable file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
$SNAP/bin/gconfig configure
 | 
			
		||||
							
								
								
									
										45
									
								
								snap/hooks/install
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										45
									
								
								snap/hooks/install
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
export SDATA=$(echo $SNAP_DATA | sed "s|$SNAP_REVISION|current|")
 | 
			
		||||
export SCOMMON="$SNAP_COMMON"
 | 
			
		||||
export isRoot=`true`
 | 
			
		||||
snapctl set gitea.snap.workdir="$SDATA/custom"
 | 
			
		||||
snapctl set gitea.snap.custom="$SCOMMON"
 | 
			
		||||
 | 
			
		||||
function mkDirCommon(){
 | 
			
		||||
  for dir in $@; do
 | 
			
		||||
    mkdir -p "$SCOMMON/$dir"
 | 
			
		||||
  done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function mkdirData(){
 | 
			
		||||
  for dir in $@; do
 | 
			
		||||
    mkdir -p "$SDATA/$dir"
 | 
			
		||||
    if [ -d $SNAP/$dir ]; then
 | 
			
		||||
      cp -r --preserve=mode           \
 | 
			
		||||
            $SNAP/$dir/*              \
 | 
			
		||||
            $SNAP/$dir/.[a-zA-Z0-9-]* \
 | 
			
		||||
            $SDATA/$dir/ 2> $SCOMMON/log/snap-mkdirData.log
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
mkDirCommon pictures           \
 | 
			
		||||
            repositories       \
 | 
			
		||||
            attachments        \
 | 
			
		||||
            data               \
 | 
			
		||||
            log
 | 
			
		||||
 | 
			
		||||
mkdirData   certs              \
 | 
			
		||||
            sshkeytest         \
 | 
			
		||||
            custom/conf        \
 | 
			
		||||
            static/templates   \
 | 
			
		||||
            static/scripts     \
 | 
			
		||||
            static/public
 | 
			
		||||
 | 
			
		||||
[[ -f $SNAP_COMMON/conf/app.ini ]] || $SNAP/bin/gconfig install
 | 
			
		||||
 | 
			
		||||
# Configure Git to use the right templates
 | 
			
		||||
mkdir -p $SDATA/git/
 | 
			
		||||
cp -r --preserve=mode $SNAP/usr/share/git-core/templates $SDATA/git/
 | 
			
		||||
$SNAP/usr/bin/git config --global init.templateDir $SDATA/git/templates/
 | 
			
		||||
		Reference in New Issue
	
	Block a user