diff --git a/.circleci/config.yml b/.circleci/config.yml index 121a53fd..65a56dda 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,22 +15,7 @@ jobs: command: | cd scripts/ bash -x ./install.sh - builddevsource: - docker: - - image: patrick330602/fake_wsl_env - steps: - - checkout - - run: - name: Install Pre-requisites - command: | - apt-get update -qq - apt-get install -qq apt-utils mime-support sudo - - run: - name: Install via Source Code - command: | - cd scripts/ - bash -x ./install-dev.sh - builddeb: + genpkg: machine: true steps: - checkout @@ -38,31 +23,13 @@ jobs: name: Install Pre-requisites command: | sudo apt-get update -qq - sudo apt-get install -qq build-essential rpm sudo + sudo apt-get install -qq build-essential rpm sudo dh-make devscripts - run: name: Build Package command: | make cd scripts sudo bash -x ./builder-deb.sh - mkdir -p /tmp/pkgs - sudo mv ../target/* /tmp/pkgs - - store_artifacts: - path: /tmp/pkgs - buildrpm: - machine: true - steps: - - checkout - - run: - name: Install Pre-requisites - command: | - sudo apt-get update -qq - sudo apt-get install -qq build-essential rpm sudo - - run: - name: Build Package - command: | - make - cd scripts sudo bash -x ./builder-rpm.sh mkdir -p /tmp/pkgs sudo mv ../target/* /tmp/pkgs @@ -70,9 +37,17 @@ jobs: path: /tmp/pkgs workflows: version: 2 - build-and-generate: + build: jobs: - buildsource - - builddevsource - - builddeb - - buildrpm + - genpkg + nightlybuild: + triggers: + - schedule: + cron: "0 0 * * *" + filters: + branches: + only: + - develop + jobs: + - genpkg diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 807e894a..ba3c814e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ running the following to get started: ```bash -curl -o- https://raw.githubusercontent.com/wslutilities/wslu/develop/scripts/install-dev.sh | bash +curl -o- https://raw.githubusercontent.com/wslutilities/wslu/develop/scripts/install.sh | bash ``` ## Build Structure @@ -13,12 +13,17 @@ curl -o- https://raw.githubusercontent.com/wslutilities/wslu/develop/scripts/ins ``` wslu |-src +| |-mime/wslview: mime file for wslview +| |-etc +| | |-wsl.ico: default icon for wslusc +| | \-runHidden.vbs: script for wslusc | |-wslu-header: Header file of all script | \-.sh: Components of script |-scripts: scripts used for building, installing and uninstalling |-tests: location for script tests \-extras - \-bats: testing utility + |-bats: testing utility + \-debian: stuff for ``` ## Build @@ -45,4 +50,4 @@ cd script sudo ./builder-rpm.sh ``` -It is suggested to do such action in Ubuntu 14.04 LTS or its corresponding environment. \ No newline at end of file +It is suggested to do such action in Ubuntu 14.04 LTS or its corresponding environment. diff --git a/Makefile b/Makefile index bda45dd0..845fc9f3 100755 --- a/Makefile +++ b/Makefile @@ -17,4 +17,4 @@ clean: test: PATH="$$CURRENT_PATH/src:$$CURRENT_PATH/out:$$PATH" - extras/bats/libexec/bats tests/header.bats tests/wslsys.bats tests/wslusc.bats tests/wslupath.bats tests/wslfetch.bats + extras/bats/libexec/bats tests/header.bats tests/wslsys.bats tests/wslusc.bats tests/wslupath.bats tests/wslfetch.bats tests/wslview.bats diff --git a/README.md b/README.md index af95130a..4654bbec 100755 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu?ref=badge_shield) [![Donate](https://badgen.net/badge/Donate/Paypal/purple)](https://www.paypal.me/callmepk/) -This is a collection of utilities for Windows 10 Linux Subsystem, such as enabling sound in WSL or creating your favorite linux GUI application shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update. +This is a collection of utilities for Windows 10 Linux Subsystem, such as converting WSL path to Windows path or creating your favorite linux GUI application shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update. **Currently supported Distro:** - Ubuntu @@ -20,6 +20,7 @@ This is a collection of utilities for Windows 10 Linux Subsystem, such as enabli - SUSE Linux Enterprise Server (SLES) - Debian GNU/Linux - Kali Linux +- **WLinux** Legacy Ubuntu is no longer supported. @@ -42,7 +43,9 @@ This is a fake WSL browser that can help you open link in default Windows browse ## Installation -Detailed installation is in Wiki/Installation. +### For WLinux + +Preinstalled in WLinux. ### For Ubuntu/Debian/Kali Linux @@ -67,11 +70,6 @@ sudo zypper in wslu Or you can download the .rpm package from release and install it using `sudo rpm -ivh "wslu*"`. -### Source Code - -To install, just run the following command in the bash prompt: -`curl -o- https://raw.githubusercontent.com/patrick330602/wslu/master/extras/scripts/install.sh | bash` - ## Contributing Check [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/extras/debian/changelog b/extras/debian/changelog new file mode 100644 index 00000000..fc458e3d --- /dev/null +++ b/extras/debian/changelog @@ -0,0 +1,16 @@ +wslu (1.8-0) stable; urgency=low + + * less dependent on lsb-release/hostname/uptime/uname. + * add support for WLinux. + * install and build scripts update. + + -- Patrick Wu Sun, 23 Sep 2018 12:00:00 +0800 + +wslu (1.7-0) stable; urgency=low + + * wslview out of experimental stage. + * Fix issues when running on top of Powershell Core 6. + * install scripts further update. + + -- Patrick Wu Sun, 02 Sep 2018 12:00:00 +0800 + diff --git a/extras/debian/compat b/extras/debian/compat new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/extras/debian/compat @@ -0,0 +1 @@ +10 diff --git a/extras/debian/control b/extras/debian/control new file mode 100644 index 00000000..b72a5f71 --- /dev/null +++ b/extras/debian/control @@ -0,0 +1,12 @@ +Source: wslu +Section: utils +Maintainer: Patrick Wu +Standards-Version: VERSIONPLACEHOLDER-0~DATEPLACEHOLDER +Priority: optional + +Package: wslu +Architecture: arm64 amd64 +Depends: bc, wget +Recommends: git +Description: A collection of utilities for Windows 10 Linux Subsystem + This is a collection of utilities for Windows 10 Linux Subsystem, such as enabling sound in WSL or creating your favorite linux app shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update and higher. diff --git a/extras/debian/copyright b/extras/debian/copyright new file mode 100644 index 00000000..fc3f981b --- /dev/null +++ b/extras/debian/copyright @@ -0,0 +1,22 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: wslu +Upstream-Contact: Patrick Wu +Source: https://github.com/wslutilities/wslu + +Files: * +Copyright: 2017-2018 Patrick Wu +License: GPL-3+ + +License: GPL-3+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff --git a/extras/debian/install b/extras/debian/install new file mode 100644 index 00000000..e9790846 --- /dev/null +++ b/extras/debian/install @@ -0,0 +1,3 @@ +src/wsl* /usr/bin +src/etc/* usr/share/wslu +src/mime/* usr/lib/mime/packages diff --git a/extras/debian/postinst b/extras/debian/postinst new file mode 100755 index 00000000..1a7f45c0 --- /dev/null +++ b/extras/debian/postinst @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/wslview 1 +update-alternatives --install /usr/bin/www-browser www-browser /usr/bin/wslview 1 diff --git a/extras/debian/prerm b/extras/debian/prerm new file mode 100755 index 00000000..b76efa42 --- /dev/null +++ b/extras/debian/prerm @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +update-alternatives --remove x-www-browser /usr/bin/wslview +update-alternatives --remove www-browser /usr/bin/wslview diff --git a/extras/debian/rules b/extras/debian/rules new file mode 100644 index 00000000..0c618c29 --- /dev/null +++ b/extras/debian/rules @@ -0,0 +1,16 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#DH_VERBOSE = 1 + +# see FEATURE AREAS in dpkg-buildflags(1) + #export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +%: + dh $@ diff --git a/scripts/builder-deb.sh b/scripts/builder-deb.sh index 3a4505ca..ed4a833f 100755 --- a/scripts/builder-deb.sh +++ b/scripts/builder-deb.sh @@ -1,55 +1,40 @@ #!/usr/bin/env bash BUILD_DIR=`mktemp --tmpdir --directory wslu-build-debian.XXXX` -BUILD_DIR_WSLVIEW=`mktemp --tmpdir --directory wslview-build-debian.XXXX` BUILD_VER=`grep 'version=' ../src/wslu-header | cut -d'=' -f 2 | xargs` +DATE=`date +%Y%m%d%H%M%S` CURRENT_DIR=`pwd` -mkdir $BUILD_DIR/{DEBIAN/,usr/,usr/bin/,usr/share/,usr/share/wslu/,usr/lib,usr/lib/mime,/usr/lib/mime/packages/} - -touch $BUILD_DIR/DEBIAN/{postinst,prerm,control} - -chmod 755 $BUILD_DIR/DEBIAN/{postinst,prerm} - -cat <>$BUILD_DIR/DEBIAN/postinst -#!/usr/bin/env bash -update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/wslview 1 -update-alternatives --install /usr/bin/www-browser www-browser /usr/bin/wslview 1 -EOF - -cat <>$BUILD_DIR/DEBIAN/prerm -#!/usr/bin/env bash -update-alternatives --remove x-www-browser /usr/bin/wslview -update-alternatives --remove www-browser /usr/bin/wslview -EOF - -cat <>$BUILD_DIR/DEBIAN/control -Package: wslu -Architecture: all -Maintainer: Patrick Wu -Depends: bc, wget, unzip, lsb-release -Recommends: git -Suggests: build-essential -Priority: optional -Version: $BUILD_VER-1 -Description: A collection of utilities for Windows 10 Linux Subsystem - This is a collection of utilities for Windows 10 Linux Subsystem, such as enabling sound in WSL or creating your favorite linux app shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update and higher. -EOF - -cp ../out/wsl* $BUILD_DIR/usr/bin/ -cp ../src/etc/* $BUILD_DIR/usr/share/wslu/ -cp ../src/mime/* $BUILD_DIR/usr/lib/mime/packages/ - -cd $BUILD_DIR -find . -type f ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' -printf '%P ' | xargs md5sum > DEBIAN/md5sums - -find $BUILD_DIR -type d -exec chmod 0755 {} \; -find $BUILD_DIR/usr/ -type f -exec chmod 0555 {} \; -find $BUILD_DIR/usr/lib/mime/packages/ -type f -exec chmod 644 {} \; - -[ -d $CURRENT_DIR/../target ] || mkdir $CURRENT_DIR/../target -cd $CURRENT_DIR/../target/ - -sudo dpkg -b $BUILD_DIR/ wslu-${BUILD_VER}.deb - +# Creating folders +mkdir -p $BUILD_DIR/wslu-$BUILD_VER/{debian,debian/source,src,src/etc,src/mime} + +# Build wslu +cd $CURRENT_DIR/../ +make + +# copy files to build folder +cp out/* $BUILD_DIR/wslu-$BUILD_VER/src/ +cp src/etc/* $BUILD_DIR/wslu-$BUILD_VER/src/etc/ +cp src/mime/* $BUILD_DIR/wslu-$BUILD_VER/src/mime/ +cp extras/debian/* $BUILD_DIR/wslu-$BUILD_VER/debian + +# modifying the files +sed -i s/VERSIONPLACEHOLDER/$BUILD_VER/g $BUILD_DIR/wslu-$BUILD_VER/debian/control +sed -i s/DATEPLACEHOLDER/$DATE/g $BUILD_DIR/wslu-$BUILD_VER/debian/control +chmod 755 $BUILD_DIR/wslu-$BUILD_VER/debian/{postinst,prerm,rules} + +# Build packages +cd $BUILD_DIR/wslu-$BUILD_VER/ +dpkg-buildpackage -rsudo -us -uc + +# Move built packages +[ -d $CURRENT_DIR/../target/debian ] || mkdir -p $CURRENT_DIR/../target/debian +cd $CURRENT_DIR/../target/debian +cp -r $BUILD_DIR/*.dsc . +cp -r $BUILD_DIR/*.deb . +cp -r $BUILD_DIR/*.tar.gz . +cp -r $BUILD_DIR/*.buildinfo . +cp -r $BUILD_DIR/*.changes . + +# CLeanup everything rm -rf $BUILD_DIR cd $CURRENT_DIR diff --git a/scripts/builder-rpm.sh b/scripts/builder-rpm.sh index 9ca8a7a5..98205f5b 100755 --- a/scripts/builder-rpm.sh +++ b/scripts/builder-rpm.sh @@ -30,7 +30,7 @@ Name: wslu Version: $BUILD_VER Release: 2 Source: wslu-$BUILD_VER.tar.gz -Requires: bc lsb-release wget unzip +Requires: bc wget unzip Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives URL: https://github.com/patrick330602/wslu/ diff --git a/scripts/install-dev.sh b/scripts/install-dev.sh deleted file mode 100755 index cef975dc..00000000 --- a/scripts/install-dev.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env bash -ORI_PATH="$(pwd)" - -if [[ -f /etc/fake-wsl-release ]]; then - echo "You are using fake WSL Environment. This is for building and testing only." -elif [[ ! -f /proc/sys/fs/binfmt_misc/WSLInterop ]]; then - echo "Your distro do not support WSL Interopability. Installation Aborted." - exit 1 -fi - -cat << EOF -WSLU ---------------- -Windows 10 Linux Subsystem Utilities -EOF - -distro="$(cat /etc/os-release | head -n1 | sed -e 's/NAME="//g')" -if [[ "$distro" == Ubuntu* ]]; then - distro="ubuntu" -elif [[ "$distro" == *Debian* ]]; then - distro="debian" -elif [[ "$distro" == *Kali* ]]; then - distro="kali" -elif [[ "$distro" == openSUSE* ]]; then - distro="opensuse" -elif [[ "$distro" == SLES* ]]; then - distro="sles" -fi - -echo "You are using: $distro" - -echo "Installing dependencies...." -case "$distro" in - 'ubuntu'|'debian'|'kali') - sudo apt install -y git build-essential bc wget unzip lsb-release make - ;; - 'opensuse') - sudo zypper -n install git bc lsb-release hostname wget unzip make - ;; - 'sles') - sudo zypper -n install git bc lsb-release wget unzip make - ;; -esac -if [[ ! -f /etc/fake-wsl-release ]]; then - echo -e "\nWSL Interopability\n*********************" - cat /proc/sys/fs/binfmt_misc/WSLInterop - echo "" -fi - -echo -e "\ntesting powershell.exe..." -powershell.exe -NoProfile -NonInteractive -Command Get-History -if [[ $? -eq 0 ]]; then - echo "powershell.exe can be invoked." -else - echo "powershell.exe failed to launch." - exit 1 -fi -ppep="`powershell.exe Get-ExecutionPolicy 2>&1 | tail -n1 | sed 's/\r$//'`" -echo -e "Powershell Execution Policy: $ppep" -if [[ "$ppep" = "Restricted" ]]; then - cat << EOF -*************************************** - WARNING -*************************************** -The execution policy for powershell.exe -is set to Restricted. You should set P- -owershell Execution Policy to Unrestri- -cted with a Powershell Prompt with Adm- -inistrator right: - Set-ExecutionPolicy Unrestricted -Due to the limitation, it is not possi- -ble to invoke this command from Bash P- -rompt. -EOF -fi - -echo -e "\ntesting cmd.exe..." -cmd.exe /c ver -if [[ $? -eq 0 ]]; then - echo "cmd.exe can be invoked." -else - echo "cmd.exe failed to launch." - exit 1 -fi - -echo -e "\ntesting reg.exe..." -reg.exe /? -if [[ $? -eq 0 ]]; then - echo "reg.exe can be invoked." -else - echo "reg.exe failed to launch." - exit 1 -fi - -if [ `pwd | grep wslu` ]; then - cd ../ - CURRENT_PATH="$(pwd)" -else - git clone https://github.com/patrick330602/wslu.git - cd wslu - git checkout develop - CURRENT_PATH="$(pwd)" -fi - -make -chmod +x $CURRENT_PATH/out/* - -PATH="$CURRENT_PATH/src:$CURRENT_PATH/out:$PATH" -git submodule init -git submodule update -extras/bats/libexec/bats tests/header.bats tests/wslsys.bats tests/wslusc.bats tests/wslupath.bats tests/wslfetch.bats -PATH=$(getconf PATH) - -for f in out/wsl*; do - bname="$(basename $f)" - sudo ln -s $CURRENT_PATH/$f /usr/bin/$bname; - echo "exec $f linked to /usr/bin/$bname"; -done - -sudo cp $CURRENT_PATH/src/mime/* /usr/lib/mime/packages/ -[ -d /usr/share/wslu ] || sudo mkdir /usr/share/wslu -sudo cp $CURRENT_PATH/src/etc/* /usr/share/wslu - -sudo update-mime -sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/wslview 1 -sudo update-alternatives --install /usr/bin/www-browser www-browser /usr/bin/wslview 1 - -cat <&1 | sed -n 3p | sed -e "s/BuildBranch//" | sed -e 's/^[[:space:]]*//' | awk '{$1=""; sub(" ", " "); print}' | sed -e 's|\r||g'` build=`reg.exe query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "CurrentBuild" 2>&1 | egrep -o '([0-9]{5})'` full_build=`reg.exe query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "BuildLabEx" 2>&1 | sed -n 3p | sed -e "s/BuildLabEx//" | sed -e 's/^[[:space:]]*//' | awk '{$1=""; sub(" ", " "); print}' | sed -e 's|\r||g'` installdate=`reg.exe query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "InstallDate" | egrep -o "(0x|0X)[a-fA-F0-9]+" | xargs printf "%d\n" | bc | xargs -I '{}' date --date="@{}"` -release="$(lsb_release -ds | sed -e 's/"//g')" -kernel="$(uname -sr)" +release="$(cat /etc/os-release | grep "PRETTY_NAME=" | sed -e 's/PRETTY_NAME=//g' -e 's/"//g')" +kernel="$(. # global config -wslu_version=1.7 +wslu_version=1.8 ## color black=`echo -e '\e[30m'` @@ -48,12 +48,11 @@ error="${red}[error]${reset}" warn="${orange}[warn]${reset}" debug="${cyan}[debug]${reset}" -## constants -help_short="wslu (-h|-v|-s)" - ## basic distro detection -distro="$(cat /etc/os-release | head -n1 | sed -e 's/NAME="//g')" -if [[ "$distro" == Ubuntu* ]]; then +distro="$(cat /etc/os-release | head -n1 | sed -e 's/NAME=\"//g')" +if [[ "$distro" == *WLinux* ]]; then + distro=wlinux +elif [[ "$distro" == Ubuntu* ]]; then distro="ubuntu" elif [[ "$distro" = *Debian* ]]; then distro="debian" @@ -65,17 +64,12 @@ elif [[ "$distro" == SLES* ]]; then distro="sles" fi -function ins_locate -{ - [ -L /usr/bin/wslsys ] && echo "$(dirname $(readlink -f /usr/bin/wslsys))" || echo "/usr/bin" -} - function help { echo -e "`basename "$1"` - Component of Windows 10 Linux Subsystem Utility -Usage: $2 - -For more help for `basename "$1"`, visit the following site: -https://github.com/patrick330602/wslu/wiki/`basename "$1"`" +Usage: $2" } + +#no_longer_use_but_might_use_it_in_the_future="For more help for `basename "$1"`, visit the following site: https://github.com/patrick330602/wslu/wiki/`basename "$1"`" + diff --git a/src/wslusc.sh b/src/wslusc.sh index eccc7a69..0dcde24f 100755 --- a/src/wslusc.sh +++ b/src/wslusc.sh @@ -1,11 +1,11 @@ -version="10" +version="14" cname="" iconpath="`wslupath -d -H`\\wslu\\wsl.ico" is_icon=0 is_gui=0 -help_short="wslusc (-i|-g|-h|-v) ..NAME..." +help_short="wslusc (-i|-g|-h|-v) ...NAME..." while [ $1 ]; do case $1 in @@ -20,13 +20,14 @@ if [[ "$cname" != "" ]]; then tpath=`wslupath -d -T` dpath=`wslupath -D` script_location="`wslupath -H`/wslu" + localfile_path="/usr/share/wslu" script_location_win="`wslupath -d -H`\\wslu" new_cname=`basename $cname` if [[ ! -f $script_location/wsl.ico ]]; then echo "${info} Default wslusc icon \"wsl.ico\" not found in Windows directory. Copying right now..." [[ -d $script_location ]] || mkdir $script_location - if [[ /usr/share/wslu/wsl.ico ]]; then - cp /usr/share/wslu/wsl.ico $script_location + if [[ $localfile_path/wsl.ico ]]; then + cp $localfile_path/wsl.ico $script_location echo "${info} Default wslusc icon \"wsl.ico\" copied. Located at $script_location." else echo "${error} runHidden.vbs not found. Failed to copy." @@ -36,8 +37,8 @@ if [[ "$cname" != "" ]]; then if [[ ! -f $script_location/runHidden.vbs ]]; then echo "${info} runHidden.vbs not found in Windows directory. Copying right now..." [[ -d $script_location ]] || mkdir $script_location - if [[ -f /usr/share/wslu/runHidden.vbs ]]; then - cp /usr/share/wslu/runHidden.vbs $script_location + if [[ -f $localfile_path/runHidden.vbs ]]; then + cp $localfile_path/runHidden.vbs $script_location echo "${info} runHidden.vbs copied. Located at $script_location." else echo "${error} runHidden.vbs not found. Failed to copy." diff --git a/src/wslview.sh b/src/wslview.sh index b79aa7d2..e0db5970 100755 --- a/src/wslview.sh +++ b/src/wslview.sh @@ -2,7 +2,7 @@ version="02" lname="" -help_short="wslview (-u|-r|-h|-v) ..LINK..." +help_short="wslview (-u|-r|-h|-v) ...LINK..." for args; do case $args in diff --git a/tests/wslfetch.bats b/tests/wslfetch.bats index 2e7a8d03..5477ad96 100755 --- a/tests/wslfetch.bats +++ b/tests/wslfetch.bats @@ -10,14 +10,10 @@ run out/wslfetch --help [ "${lines[0]}" = "wslfetch - Component of Windows 10 Linux Subsystem Utility" ] [ "${lines[1]}" = "Usage: wslfetch (-h|-v|-s|-l|-c)" ] - [ "${lines[2]}" = "For more help for wslfetch, visit the following site:" ] - [ "${lines[3]}" = "https://github.com/patrick330602/wslu/wiki/wslfetch" ] } @test "wslfetch - Help - Alt." { run out/wslfetch -h [ "${lines[0]}" = "wslfetch - Component of Windows 10 Linux Subsystem Utility" ] [ "${lines[1]}" = "Usage: wslfetch (-h|-v|-s|-l|-c)" ] - [ "${lines[2]}" = "For more help for wslfetch, visit the following site:" ] - [ "${lines[3]}" = "https://github.com/patrick330602/wslu/wiki/wslfetch" ] } diff --git a/tests/wslsys.bats b/tests/wslsys.bats index a2723413..5da05eb8 100755 --- a/tests/wslsys.bats +++ b/tests/wslsys.bats @@ -10,14 +10,10 @@ run out/wslsys --help [ "${lines[0]}" = "wslsys - Component of Windows 10 Linux Subsystem Utility" ] [ "${lines[1]}" = "Usage: wslsys (-h|-v|-S|-U|-b|-B|-fB|-R|-K|-P) -s" ] - [ "${lines[2]}" = "For more help for wslsys, visit the following site:" ] - [ "${lines[3]}" = "https://github.com/patrick330602/wslu/wiki/wslsys" ] } @test "wslsys - Help - Alt." { run out/wslsys -h [ "${lines[0]}" = "wslsys - Component of Windows 10 Linux Subsystem Utility" ] [ "${lines[1]}" = "Usage: wslsys (-h|-v|-S|-U|-b|-B|-fB|-R|-K|-P) -s" ] - [ "${lines[2]}" = "For more help for wslsys, visit the following site:" ] - [ "${lines[3]}" = "https://github.com/patrick330602/wslu/wiki/wslsys" ] } diff --git a/tests/wslupath.bats b/tests/wslupath.bats index 83dac257..65c8da1b 100755 --- a/tests/wslupath.bats +++ b/tests/wslupath.bats @@ -13,8 +13,6 @@ [ "${lines[0]}" = "wslupath - Component of Windows 10 Linux Subsystem Utility" ] [ "${lines[1]}" = "Usage: wslupath (-dOr) [-D|-A|-T|-S|-W|-s|-su|-H|-P|...NAME...]" ] [ "${lines[2]}" = "wslupath (-h|-v|-R)" ] - [ "${lines[3]}" = "For more help for wslupath, visit the following site:" ] - [ "${lines[4]}" = "https://github.com/patrick330602/wslu/wiki/wslupath" ] } @test "wslupath - Help - Alt." { @@ -22,8 +20,6 @@ [ "${lines[0]}" = "wslupath - Component of Windows 10 Linux Subsystem Utility" ] [ "${lines[1]}" = "Usage: wslupath (-dOr) [-D|-A|-T|-S|-W|-s|-su|-H|-P|...NAME...]" ] [ "${lines[2]}" = "wslupath (-h|-v|-R)" ] - [ "${lines[3]}" = "For more help for wslupath, visit the following site:" ] - [ "${lines[4]}" = "https://github.com/patrick330602/wslu/wiki/wslupath" ] } @test "wslupath - Available Registery" { run out/wslupath --avail-reg diff --git a/tests/wslusc.bats b/tests/wslusc.bats index d6e4b4a9..683adc58 100755 --- a/tests/wslusc.bats +++ b/tests/wslusc.bats @@ -17,17 +17,13 @@ teardown() { @test "wslusc - Help" { run out/wslusc --help [ "${lines[0]}" = "wslusc - Component of Windows 10 Linux Subsystem Utility" ] - [ "${lines[1]}" = "Usage: wslusc (-g|-h|-v) ..NAME..." ] - [ "${lines[2]}" = "For more help for wslusc, visit the following site:" ] - [ "${lines[3]}" = "https://github.com/patrick330602/wslu/wiki/wslusc" ] + [ "${lines[1]}" = "Usage: wslusc (-i|-g|-h|-v) ...NAME..." ] } @test "wslusc - Help - Alt." { run out/wslusc -h [ "${lines[0]}" = "wslusc - Component of Windows 10 Linux Subsystem Utility" ] - [ "${lines[1]}" = "Usage: wslusc (-g|-h|-v) ..NAME..." ] - [ "${lines[2]}" = "For more help for wslusc, visit the following site:" ] - [ "${lines[3]}" = "https://github.com/patrick330602/wslu/wiki/wslusc" ] + [ "${lines[1]}" = "Usage: wslusc (-i|-g|-h|-v) ...NAME..." ] } @test "wslusc - without GUI" { @@ -36,6 +32,6 @@ teardown() { } @test "wslusc - with GUI" { - run out/wslusc -x test2 + run out/wslusc -g test2 [ -f "`out/wslupath -D`/test2.lnk" ] } diff --git a/tests/wslview.bats b/tests/wslview.bats new file mode 100644 index 00000000..4d1776db --- /dev/null +++ b/tests/wslview.bats @@ -0,0 +1,19 @@ +#!/usr/bin/env bats + +#wslview testing +@test "wslview - No parameter" { + run out/wslview + [ "$status" -eq 21 ] +} + +@test "wslview - Help" { + run out/wslview --help + [ "${lines[0]}" = "wslview - Component of Windows 10 Linux Subsystem Utility" ] + [ "${lines[1]}" = "Usage: wslview (-u|-r|-h|-v) ...LINK..." ] +} + +@test "wslview - Help - Alt." { + run out/wslview -h + [ "${lines[0]}" = "wslview - Component of Windows 10 Linux Subsystem Utility" ] + [ "${lines[1]}" = "Usage: wslview (-u|-r|-h|-v) ...LINK..." ] +}