Skip to content

Commit

Permalink
.#156: fixed upgrade for the tabbed version
Browse files Browse the repository at this point in the history
fatty is compiled directly at build time
moved fatty to  https://github.com/juho-p/fatty.git
  • Loading branch information
mskyaxl committed Apr 22, 2020
1 parent 012d36f commit 90fdf2d
Show file tree
Hide file tree
Showing 21 changed files with 154 additions and 89 deletions.
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
/src/build
/build
/output
/src/wsl-terminal
/release
*.exe
*.zip
*.7z
.debug
.debug
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.0
0.9.1
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
16 changes: 16 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e


./prepare.sh &&
../build/ahk/Compiler/Ahk2Exe.exe /in ../src/open-wsl.ahk /out ../build/open-wsl.exe /icon ../icons/terminal.ico &&
../build/ahk/Compiler/Ahk2Exe.exe /in ../src/open-wsl.ahk /out ../build/run-wsl-file.exe /icon ../icons/script.ico &&
../build/ahk/Compiler/Ahk2Exe.exe /in ../src/open-wsl.ahk /out ../build/vim.exe /icon ../icons/text.ico &&
../build/ahk/Compiler/Ahk2Exe.exe /in ../src/open-wsl.ahk /out ../build/emacs.exe /icon ../icons/text.ico &&
./package.sh &&
echo Build succeeded. &&
exit

echo Build failed. &&
echo failed
exit 1
31 changes: 31 additions & 0 deletions scripts/build_fatty.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
#this will run in WSL environment
set -e


if [[ ! -d fatty_build ]]; then
mkdir fatty_build
fi

cd fatty_build

if [[ ! -d fatty ]]; then
git clone --depth 1 https://github.com/paolo-sz/fatty.git
fi

cd fatty
#remove any links as cygwin cannot handle links properly
for link in $(find src/ -type l)
do
loc="$(dirname "$link")"
file="$(readlink "$link")"
rm $link
cp "src/$file" "$loc"
done
pwd
#build using cygwin
/mnt/c/cygwin64/bin/bash.exe -c ../../../scripts/compile_fatty.sh

version=$(printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"-1)
rm -f ../../fatty-$version.7z
7z a ../../fatty-$version.7z fatty
File renamed without changes.
12 changes: 12 additions & 0 deletions scripts/compile_fatty.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
#this will run in cygwin environment
export PATH=/bin

make -j
strip src/fatty.exe

mkdir -p fatty/{bin,doc,etc/lang}
cp bin/fatty.exe fatty/bin
cp /bin/{cyggcc_s-seh-1.dll,cygstdc++-6.dll,cygwin-console-helper.exe,cygwin1.dll} fatty/bin
cp VERSION LICENSE* README.md fatty/doc
cp lang/*.po fatty/etc/lang
56 changes: 56 additions & 0 deletions scripts/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

set -e

if [[ ! -d ../release ]]; then
mkdir -p ../release
fi


cd ../build
[[ -e .debug ]] && {
mkdir -p wsl-terminal
cd wsl-terminal
cp -r build/{bin,etc} .
cp -r {*.exe,tools,cmdtool} ../../VERSION .
exit
}

rm -rf wsl-terminal
mkdir -p wsl-terminal
cd wsl-terminal

cp -r ../{bin,etc,doc} .
cp -r ../../src/{tools,cmdtool} ../../VERSION ../*.exe .
cp -r ../../{LICENSE,README.md} doc/
rm -f ../*.exe
cd ..

version="$(cat ../VERSION)"
rm -f ../release/wsl-terminal-${version}.7z
7z a ../release/wsl-terminal-${version}.7z wsl-terminal
rm -f ../release/wsl-terminal-${version}.zip
7z a ../release/wsl-terminal-${version}.zip wsl-terminal

rm -rf ../output && cp -r wsl-terminal ../output

# fatty
cd wsl-terminal
cp ../fatty/bin/fatty.exe bin/mintty.exe
cp ../fatty/bin/*.dll bin/
cp -r ../fatty/doc/ doc/fatty
rm -r etc/lang
cp -r ../fatty/etc/lang etc/
rm -r doc/mintty
mv etc/minttyrc etc/fattyrc
echo "_tabbed" >> VERSION
cd ..

mv wsl-terminal wsl-terminal-tabbed

rm -f ../release/wsl-terminal-tabbed-${version}.7z
7z a ../release/wsl-terminal-tabbed-${version}.7z wsl-terminal-tabbed
rm -f ../release/wsl-terminal-tabbed-${version}.zip
7z a ../release/wsl-terminal-tabbed-${version}.zip wsl-terminal-tabbed

rm -r wsl-terminal-tabbed
16 changes: 10 additions & 6 deletions src/prepare.sh → scripts/prepare.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -e

cygwin_version="3.1.2-1"
mintty_version="3.1.0-1"
cygwin_version="3.1.4-1"
mintty_version="3.1.4-1"
fatty_version="r2549.ee7e4a1-1"
wslbridge2_version="0.5"

Expand All @@ -19,14 +19,18 @@ type wget >/dev/null && \
exit 1
}

cd ..
mkdir -p build && cd build



wget -nc http://mirrors.kernel.org/sourceware/cygwin/x86_64/release/cygwin/cygwin-${cygwin_version}.tar.xz
wget -nc http://mirrors.kernel.org/sourceware/cygwin/x86_64/release/mintty/mintty-${mintty_version}.tar.xz
wget -nc https://github.com/goreliu/fatty-prebuilds/releases/download/${fatty_version}/fatty-${fatty_version}.7z
wget -nc https://github.com/Biswa96/wslbridge2/releases/download/v${wslbridge2_version}/wslbridge2_cygwin_x86_64.7z
wget -nc https://autohotkey.com/download/ahk.zip

../scripts/build_fatty.sh
pwd
rm -rf bin etc usr doc

tar -xvf cygwin-${cygwin_version}.tar.xz \
Expand All @@ -35,15 +39,15 @@ tar -xvf cygwin-${cygwin_version}.tar.xz \
usr/share/doc/Cygwin

tar -xvf mintty-${mintty_version}.tar.xz usr/bin/mintty.exe usr/share/doc usr/share/mintty/lang
7z x -y fatty-${fatty_version}.7z fatty/bin/{fatty.exe,cyggcc_s-seh-1.dll,cygstdc++-6.dll} fatty/doc fatty/etc/lang
7z x -y fatty-*.7z fatty/bin/{fatty.exe,cyggcc_s-seh-1.dll,cygstdc++-6.dll} fatty/doc fatty/etc/lang


7z x -y wslbridge2_cygwin_x86_64.7z -ousr/bin
rm usr/bin/rawpty.exe
mkdir -p usr/share/doc/wslbridge2
wget -nc https://raw.githubusercontent.com/Biswa96/wslbridge2/v${wslbridge2_version}/LICENSE -Ousr/share/doc/wslbridge2/LICENSE

cp -r ../etc .
cp -r ../src/etc .
rm -rf bin doc
mv usr/bin usr/share/doc .
mv usr/share/mintty/lang etc/
Expand All @@ -55,5 +59,5 @@ cd ..

cat > "doc/wsl-terminal home.url" <<EOF
[InternetShortcut]
URL=https://goreliu.github.io/wsl-terminal/
URL=https://mskyaxl.github.io/wsl-terminal/
EOF
14 changes: 0 additions & 14 deletions src/build.bat

This file was deleted.

39 changes: 25 additions & 14 deletions src/cmdtool
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ elif [[ "$1" == update ]]; then
exit 1
}

version=$(cat VERSION)
semanticVersion_reqex=".*(^[0-9]+\.[0-9]+\.[0-9]+)(-[0-9A-Za-z]+)*(_(tabbed))*$.*"
version=$(cat VERSION | sed -rn 's/'$semanticVersion_reqex'/\1/p')
tabbed=$(cat VERSION | sed -rn 's/'$semanticVersion_reqex'/\4/p')
echo Checking the latest version ...
latest_version=$(wget https://raw.githubusercontent.com/mskyaxl/wsl-terminal/master/VERSION -O -)
if [[ "$version" == "$latest_version" ]]; then
Expand All @@ -86,27 +88,36 @@ elif [[ "$1" == update ]]; then
exit
fi

filename=wsl-terminal-$latest_version.7z
if [[ "$tabbed" == tabbed ]]; then
echo "\ntabbed version detected"
filename=wsl-terminal-tabbed-$latest_version.7z
foldername=wsl-terminal-tabbed
ttyrcfile=fattyrc
else
filename=wsl-terminal-$latest_version.7z
foldername=wsl-terminal
ttyrcfile=minttyrc
fi

if [[ ! -e "$filename" ]]; then
wget -c "https://github.com/goreliu/wsl-terminal/releases/download/v$latest_version/wsl-terminal-$latest_version.7z"
wget -c "https://github.com/mskyaxl/wsl-terminal/releases/download/v$latest_version/$filename"
fi

rm -rf wsl-terminal
rm -rf $foldername
7z x "$filename" || {
echo "$filename is broken, try again."
rm -v "$filename"
exit 1
}

mv -v wsl-terminal/tools/* tools/
mv -v wsl-terminal/etc/wsl-terminal.conf etc/wsl-terminal.conf.pacnew
mv -v wsl-terminal/etc/minttyrc etc/minttyrc.pacnew
mv -v wsl-terminal/etc/lang/* etc/lang/
mv -v wsl-terminal/etc/themes/* etc/themes/
mv -v wsl-terminal/etc/README.md etc/
mv -v $foldername/tools/* tools/
mv -v $foldername/etc/wsl-terminal.conf etc/wsl-terminal.conf.pacnew
mv -v $foldername/etc/$ttyrcfile etc/$ttyrcfile.pacnew
mv -v $foldername/etc/lang/* etc/lang/
mv -v $foldername/etc/themes/* etc/themes/
mv -v $foldername/etc/README.md etc/

cd wsl-terminal/bin
cd $foldername/bin
for i in *; do
mv "../../bin/$i" "../../bin/$i.$$.bak"
mv -v "$i" "../../bin/$i"
Expand All @@ -115,10 +126,10 @@ elif [[ "$1" == update ]]; then
cd ../..

rm -rf doc
mv -v wsl-terminal/doc .
mv -v wsl-terminal/{*.*,cmdtool,VERSION} .
mv -v $foldername/doc .
mv -v $foldername/{*.*,cmdtool,VERSION} .

rm -rf wsl-terminal
rm -rf $foldername
rm "$filename"
echo OK
exit
Expand Down
49 changes: 0 additions & 49 deletions src/package.sh

This file was deleted.

0 comments on commit 90fdf2d

Please sign in to comment.